mathematica-8

Match legend and Plot size

你。 提交于 2019-12-07 09:22:43
问题 Please Consider : intense = Reverse[Round[Rationalize /@ N[10^Range[0, 3, 1/3]]]]; values = Range[0, 9/10, 1/10]; intensityLegend = Column[Prepend[MapThread[ Function[{intensity, values}, Row[{Graphics[{(Lighter[Blue, values]), Rectangle[{0, 0}, {4, 1}], Black, Text[Style[ToString[intensity], 16, Bold], {2, .5}]}]}]], {intense, values}], Text[Style["Photons Number", Bold, 15]]]]; IntersectionDp1={{1., 588.377}, {2.15443, 580.306}, {4.64159, 573.466}, {10.,560.664}, {21.5443, 552.031}, {46

Mathematica: Can I match the BarChart Legend to the stacked bars?

♀尐吖头ヾ 提交于 2019-12-07 02:29:03
问题 I would like to have the vertical arrangement of colors in stacked bars match the arrangement of colors in the chart legend. But no matter what I try, they don't match. Here's the situation BarChart[{{5, 37, 56}, {22, 49, 28}, {31, 60, 10}}, ChartLayout -> "Percentile", ChartLegends -> Placed[{"1-Volume", "2-Area", "3-Length"}, Right], ChartLabels -> {{"Before", "During", "After"}, None}] In the real-world example the legend has quite a few more entries (6), so it would be nice if the order

Mathematica: Obtaining graphics primitives and directives

旧时模样 提交于 2019-12-05 21:31:10
How do you obtain graphic primitives and directives from a Graphics object? Leonid Shifrin showed how to remove them in the post Mathematica: Removing graphics primitives . I tried applying something similar but I can't get what I want. Consider this example: g1 = ListPlot3D[ {{0, -1, 0}, {0, 1, 0}, {-1, 0, 1}, {1, 0, 1}, {-1, 1, 1}}, Mesh -> {2, 2}, Boxed -> False, Axes -> False, ViewPoint -> {2, -2, 1}, ViewVertical -> {0, 0, 1}, MeshStyle -> RGBColor[0, 0.5, 0], BoundaryStyle -> RGBColor[1, 0.5, 0] ]; g2 = ImportString[ExportString[g1, "PDF", Background -> None], "PDF"][[1]] g2 is now a

Line Style using Graphics3D in Mathematica

谁说胖子不能爱 提交于 2019-12-05 21:06:05
Consider the following : cAxes = {{{0, 0, 0}, {0, 0, 1}}, {{0, 0, 0}, {0, 1, 0}}, {{0, 0,0}, {1, 0, 0}}}; Graphics3D[{Line /@ cAxes}, Boxed -> False] How can Style differently the 3 lines ? The answer above are good, but I want to show some alternatives. I show that it is possible to use Style for this, and that Tube is an interesting alternative to Line . cAxes = {{{0, 0, 0}, {0, 0, 1}}, {{0, 0, 0}, {0, 1, 0}}, {{0, 0, 0}, {1, 0, 0}}}; tubes = Tube@# ~Style~ #2 & ~MapThread~ {cAxes, {Red, Green, Blue}}; Graphics3D[tubes, Boxed -> False] Here's an example: colors = {Red, Green, Blue}; style =

Match legend and Plot size

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-05 12:30:09
Please Consider : intense = Reverse[Round[Rationalize /@ N[10^Range[0, 3, 1/3]]]]; values = Range[0, 9/10, 1/10]; intensityLegend = Column[Prepend[MapThread[ Function[{intensity, values}, Row[{Graphics[{(Lighter[Blue, values]), Rectangle[{0, 0}, {4, 1}], Black, Text[Style[ToString[intensity], 16, Bold], {2, .5}]}]}]], {intense, values}], Text[Style["Photons Number", Bold, 15]]]]; IntersectionDp1={{1., 588.377}, {2.15443, 580.306}, {4.64159, 573.466}, {10.,560.664}, {21.5443, 552.031}, {46.4159, 547.57}, {100.,545.051}, {215.443, 543.578}, {464.159, 542.281}, {1000., 541.346}} FindD1

Mathematica: Can I match the BarChart Legend to the stacked bars?

落花浮王杯 提交于 2019-12-05 08:17:55
I would like to have the vertical arrangement of colors in stacked bars match the arrangement of colors in the chart legend. But no matter what I try, they don't match. Here's the situation BarChart[{{5, 37, 56}, {22, 49, 28}, {31, 60, 10}}, ChartLayout -> "Percentile", ChartLegends -> Placed[{"1-Volume", "2-Area", "3-Length"}, Right], ChartLabels -> {{"Before", "During", "After"}, None}] In the real-world example the legend has quite a few more entries (6), so it would be nice if the order of the legend colors matched the order in the bars. I realize that I could set the ChartLegends to

Function minimization with equality constraints in Mathematica 8

醉酒当歌 提交于 2019-12-05 04:52:09
When using constraints with simple equality in Mathematica 8, minimization doesn't work. E.g. FindMinimum[{x^2 + y^2, y == 1}, {x, y}] works ok in Mathematica 6, but gives errors in version 8. Can anyone else confirm (or explain) this? Looks like fixing one of the parameters with a constraint confuses version 8. Putting xy==1 is OK, also any inequality. Any simple workaround on this? I have tried changing the Method , no luck. I would like to keep all the parameters in the parameter list, but hold some of them with simple constraint instead of removing the parameter name from the list. I have

Photo Mosaic in Mathematica: an example from 2008 doesn't work in Mathematica 8

匆匆过客 提交于 2019-12-04 07:48:30
I'm trying to get a Mathematica example working. It's the one on Theo Gray's blog . I think that Mathematica must have changed since he wrote that code (May 2008), since I'm unable to get anything reasonable out of it, despite changing nearly everything. Do I use ImageData instead of Import? Can anyone suggest a version of this code that works for Mathematica 8? imagePool = Map[With[{i = Import[#]}, {i, Mean[Flatten[N[i[[1, 1]]], 1]]}] &, FileNames["Pool/*.jpg"]]; closeMatch[c_] := RandomChoice[Take[SortBy[imagePool, Norm[c - #[[2]]] &], 20]][[1]]; Grid[Reverse[ Map[closeMatch, Import[

A problem in Mathematica 8 with function declaration

你说的曾经没有我的故事 提交于 2019-12-04 05:18:19
This is a strange result with a function defined as "functionB" in this example. Can someone explain this? I want to plot functionB[x] and functionB[Sqrt[x]] , they must be different, but this code shows that functionB[x] = functionB[Sqrt[x]] , which is impossible. model = 4/Sqrt[3] - a1/(x + b1) - a2/(x + b2)^2 - a3/(x + b3)^4; fit = {a1 -> 0.27, a2 -> 0.335, a3 -> -0.347, b1 -> 4.29, b2 -> 0.435, b3 -> 0.712}; functionB[x_] := model /. fit Show[ ParametricPlot[{x, functionB[x]}, {x, 0, 1}], ParametricPlot[{x, functionB[Sqrt[x]]}, {x, 0, 1}] ] functionB[x] must different from functionB[Sqrt[x

How can I show % values on the y axis of a plot?

风格不统一 提交于 2019-12-04 04:58:50
In any Mathematica chart or plot how can I show % values on the y axis? I may have data like this: data = {{{2010, 8, 3}, 0.}, {{2010, 8, 31}, -0.052208}, {{2010, 9, 30}, 0.008221}, {{2010, 10, 29}, 0.133203}, {{2010, 11, 30}, 0.044557}, {{2010, 12, 31}, 0.164891}, {{2011, 1, 31}, 0.055141}, {{2011, 2, 28}, 0.114801}, {{2011, 3, 31}, 0.170501}, {{2011, 4, 29}, 0.347566}, {{2011, 5, 31}, 0.461358}, {{2011, 6, 30}, 0.244649}, {{2011, 7, 29}, 0.41939}, {{2011, 8, 31}, 0.589874}, {{2011, 9, 30}, 0.444151}, {{2011, 10, 31}, 0.549095}, {{2011, 11, 30}, 0.539669}}; DateListPlot@data I just want the y