Tag Info

New answers tagged

5

I can add to Mr.Wizards' answer that when InputForm is wrapped by any head like List (// InputForm // List) the output is much more readable because in this case it is represented in StandardForm instead of pure textual representation. StandardForm allows semantical selection by double-clicking. For inspecting the low-level structure of graphics I find ...


5

As far as I know the specific output format of Plot (and similar commands) is not documented. I believe it has changed between versions therefore any post-processing (such as your replacement rule) must be considered potentially version dependent. As Michael comments above the documentation does state: Plot normally returns Graphics[{Line[...],...}]. ...


1

I used 3 rather than 6 functions for each plot and used a Frame rather than Axes to reduce the clutter. f := RandomReal[]; h := Floor[f*20]; When the Table is inside of the Plot use Evaluate Manipulate[ Plot[ Evaluate[ Table[f Sin[h x + h t], {3}]], {x, -5, 5}, PlotRange -> {-1.1, 1.1}, Frame -> True, Axes -> False], {{t, 5}, 0, ...


1

Considering work-arounds, Style and Inactivate seem to work well together. Plot[x , {x, 0, 1}, AxesLabel -> {Style["M", Italic], Style[Inactivate[InputForm[E] = M c^2, (Set | Times)], "TraditionalForm"]}] Inactivating Times keeps M c^2 from being rewritten to c^2 M.


6

I'm not sure what's going on with HoldForm[InputForm[ℰ]], but I think I know what's going on with Plot. It appears at some point ReleaseHold is called because wrapping HoldForm twice fixes your problem. Plot[x^2, {x, -2, 2}, AxesLabel -> {x, HoldForm[HoldForm[InputForm[E = 1]]]}]


6

I can't comment on exactly why HoldForm has changed but I believe your examples fall under the purview of the new Active/Inactive functionality. For example: Clear[x]; Plot[Sin[x], {x, 0, 1}, AxesLabel -> {Inactivate[x = 3], Inactive[Set][InputForm[E], 3]}] x Note, however that Inactivate can't be used with InputForm, since you want InputForm to ...


0

What you have up there is "a contour" but not the 0 [zero] contour. The zero contour has two solutions 1)-asin(y^3), 2)-y _Plot these two solutions on the same graph. _To see something, plot both directions ± 1.25 _Mesh both directions 199 [typical Mathcad] _Make the Z level small ± 0.001 _Plot both g [function] & Plane as surface plot on the same 3D ...


1

If I understand your question then you want: Plot3D[Sin[x + y^2], {x, -3, 3}, {y, -2, 2}, MeshFunctions -> {#1 &, #3 &}] If that is the case this is directly documented and the question should probably be closed. If not please try again.


5

Here's a V10 solution with ImplicitRegion. fns = {1 + 3/2 v, 1 + 2/3 m + 1/6 v, 9/4 + 1/8 v, 10/7 m, m + Min[2/3, 1/2 m, v]}; rgns = Table[ ImplicitRegion[ Reduce[{And @@ Thread[fns[[i]] < Drop[fns, {i}]], 1 < m < 2, 0 < v < 1}, {m, v}], {m, v}], {i, Length[fns]}]; Show[MapThread[ RegionPlot, {rgns, Thread[PlotStyle -> ...


4

flist = {1 + 3/2 v, 1 + 2/3 m + 1/6 v, 9/4 + 1/8 v, 10/7 m, m + Min[2/3, 1/2 m, v]}; pieceW = Piecewise[Table[{i, flist[[i]] == Min[flist]}, {i, 1, Length@flist}]]; DensityPlot DensityPlot[pieceW, {m, 1, 2}, {v, 0, 1}, PlotPoints -> 200, ImageSize -> 500, ColorFunction -> ({Orange, Red, Blue, Black, Green}[[#]] &), ...


5

In my opinion it's not a bad thing to use Plot3D for this as you offload plane intersection to the GPU. You can get an orthogonal view like this: Plot3D[ {1 + 3/2 v, 1 + 2/3 m + 1/6 v, 9/4 + 1/8 v, 10/7 m, m + Min[2/3, 1/2 m, v]}, {m, 1,2}, {v, 0, 1}, PlotStyle -> {Orange, Red, Blue, Green, Black}, ViewPoint -> {0, 0, -∞} ]


2

You mention two parameters, m and bsp, but not the third ξ. I will concentrate on solving f'[η] == 0.99 for ξ == 0.2. Use ParametricNDSolveValue to set up the differential equations, and use WhenEvent to solve any ancillary equations that you wish, for example f'[η] == 0.99. If you use Sow as I did, you need to turn the caching off, or the root will be ...


1

Here is an arc-length reparametrization in terms of a function tfn that maps the arclength to the parameter t. It's important to use AspectRatio -> Automatic to get the spacing even. There are two truncation-error issues with parametrizing the full length of the curve. One is that the stopping point is found by stepping past the end of the curve. ...


1

I think it may be a bug. One can explicitly specify the layout of plot, for example, LineLegend[{Red, Blue}, {Abs[Subscript[a, 2]/Subscript[a, 1]], Abs[Subscript[a, 3]/Subscript[a, 1]]}, LegendLayout -> (Grid[{Flatten@#}] &)] And here is the plotting function applying the above method: Plot[{x, x^2}, {x, 0, 5}, PlotLegends -> ...


1

This is not quite satisfactory but at least a row: row[p_] := TableForm[p, TableAlignments -> Center, TableDirections -> Row] leg := LineLegend[{Orange, Blue}, {TraditionalForm[Abs[Subscript[a, 2]/Subscript[a, 1]]], TraditionalForm[Abs[Subscript[a, 3]/Subscript[a, 1]]]}, LegendLayout -> row] Plot[{x, x^2}, {x, 0, 5}, PlotRange -> ...


0

myPlot[fun_, range : {_, _, _}, incr_: 0.2] := Module[{plo = Plot[fun, range], r, q}, r = Round@First@Last@Last@AbsoluteOptions[plo, PlotRange]; q = Range[r[[1]], r[[2]], incr]; Plot[fun, range, Frame -> True, FrameTicks -> {{Partition[Riffle[q, (q /. x_Rational :> N[x]) "x"],2], None}, {Automatic, None}}]] myPlot[Sin @ a, {a, ...


6

I would use MeshShading, as shown in the documentation for ParametricPlot3D: ParametricPlot3D[{x, y, x^2 + y^2 - 5}, {y, -3, 3}, {x, -3, 3}, MeshShading -> {Directive[Opacity[.8], Blue], Directive[Opacity[.8], Yellow]}, Mesh -> {{0}}, MeshFunctions -> {#3 &}, BoundaryStyle -> {Black, Thickness[.01]}, Lighting -> "Neutral"]


3

Update: BubbleChart with a custom ChartElementFunction: bcdata = MapIndexed[Join[#2, {#1, 1}] &, whiteballs, {-1}]; (* transform data to a form acceptable for BarChart3D *) ceF[ind_:3, sz_:36, c_:Black][{{xmin_, xmax_}, {ymin_, ymax_},{zmin_, zmax_}}, v_, m_] := Dynamic@Module[{vtc = {{0, 0}, {0, 1}, {1, 1}, {1, 0}}}, ...


2

The maximum number of labeled bars seems to be limited to 99 when LabelingFunction is used. An alternative work-around is to wrap data with Labeled: RandomSeed[1] barchart2[n_,m_]:= Module[{dt=RandomInteger[10,{n,m}]}, BarChart[Labeled[#,#,Center]&/@#&/@dt, AspectRatio->0.2,ImageSize->700, ...


0

SetDelayed Just inserted some SetDelayed assignments. Thought the 3rd one (xsi) gave reason for messages. It works fine now. Clear@"`*" N1[\[Lambda]_, n_] := Sqrt[(2*\[Lambda] - 2 n - 1)*Gamma[n + 1]/Gamma[2*\[Lambda] - n]] b[\[Lambda]_, n_, j_] := (-1)^j*(1/j!)* Gamma[2*\[Lambda] - n]/(Gamma[2*\[Lambda] - 2 n + j]* Gamma[n - j + 1]) ...


2

It's in the documentation for FrameTicks here: http://reference.wolfram.com/language/ref/FrameTicks.html Plot[Sin[x], {x, 0, 10}, Frame -> True, FrameTicks -> {{{-1, 0, 1}, None}, {{0, Pi, 2 Pi, 3 Pi}, None}}] Which plots If you want custom labels, as per Is it possible to substitute tick labels with alternative text? Plot[Sin[x], {x, 0, 10}, ...


2

A workaround is just to use multiple bar charts for the data RandomSeed[1]; Clear[barchart]; barchart[n_, partitions_: 1] := Module[ {m = Ceiling[n/partitions]}, BarChart[ #, LabelingFunction -> (Placed[#1, Center] &), AspectRatio -> 0.2, ImageSize -> 700, ChartLayout -> "Percentile"] & /@ Partition[ ...


6

The theme generates a framed plot. You need to use FrameLabel,e.g. Plot[x^2, {x, 0, 3}, FrameLabel -> {Style[x, 30], Style[y, 30]}, PlotTheme -> "Scientific"]


4

"Scientific" is a framed plot style therefore you need FrameLabel: Plot[x^2, {x, 0, 10}, FrameLabel -> {x}, PlotTheme -> "Scientific"]


10

You can use PolarPlot to plot the curves. As noted in the question you need to map the polar angle onto the -1 to 1 domain of the polynomials. You should also note that only the even polynomials are plotted. PolarPlot[Evaluate @ Table[n + ChebyshevT[n, t/Pi - 1], {n, 0, 40, 2}], {t, 0, 2 Pi}] To get the filling effect you can used FilledCurve: Graphics ...


1

Use value -> label in the list of values: Manipulate[ plot[[n]], {plot, {rawplots -> "foo", weightplots -> "bar", linearizedplots -> "baz"}, PopupMenu} ]


1

Question How do I prevent Part[] from trying to decompose symbolic expressions when it is evaluated? Mathematica 10 implements something like your listPart (with additional functionality): Indexed: Indexed can be used to indicate components of symbolic vectors, matrices, tensors, etc. When expr is a list, Indexed[expr,i] gives ...


1

An Alternative: a = Transpose[{ExpDataCycles, ExpDataMpa}]; b = Interpolation[a, InterpolationOrder -> 2]; c = LogLinearPlot[b[x], {x, 6., 10^6.}, GridLines -> Automatic]; d = ListLogLinearPlot[a, PlotStyle -> Red]; Show[c, d, PlotRange -> All, ImageSize -> 400]


4

@rcollyer's answer is 100% correct, though it is telling that the ListLogLinearPlot of your data follows a polynomial shape. This tells me that your y-values follows a polynomial function with your Log[x] values. The plots seem to confirm this, as the curve fits your data much better: Clear[ExpDataCyclesMpa, LeastSqr] ExpDataCyclesMpa = ...


1

Use LogLinearPlot, instead: ExpDataCyclesMpa = Transpose[{ExpDataCycles, ExpDataMpa}]; LeastSqr = Fit[ExpDataCyclesMpa, {1, x, x^2}, x]; Show[ListLogLinearPlot[Transpose[{ExpDataCycles, ExpDataMpa}]], LogLinearPlot[LeastSqr, {x, 1, 1100000}]]


1

You can transform all your data points to xyz and plot them. data = Flatten[Table[{1, theta, phi}, {phi, 0, 2 Pi, Pi/10.}, {theta, 0, Pi, Pi/10.}], 1]; (*your set of data*) rtox[sphdata_] := sphdata /. {r_, theta_, phi_} -> CoordinateTransform["Spherical" -> "Cartesian", {r, theta, phi}] (*to change your table to cartesian from spherical*) ...


5

CoordinateTransformData[ "Spherical" -> "Cartesian", "Mapping", #]&/@ datalist Example: Graphics3D@{Sphere[{0, 0, 0}, .95], Point[CoordinateTransformData["Spherical" -> "Cartesian", "Mapping", #] & /@ Table[ { 1, RandomReal[{0, Pi}], RandomReal[{-Pi, Pi}]}, {2000}]]} It may also be useful to see how you can ...


8

With the data beeing data = RandomVariate[NormalDistribution[0, 1], 200]; the range of the box specified to be one sigma (approx. 68.3 %tile range) by sigma=Erf[1/Sqrt[2]] and a limit for the fences defined to be 10 % fencesLimit = 0.1 we can plot a BoxWhiskerChart using: BoxWhiskerChart[data, "Median", Method -> "BoxRange" -> (Quantile[#, ...


4

There are several problems here. First, you are mixing syntax for two different systems: the old (poor) Plot Legends package from version 8 and prior, and the new improved integrated legend functions in version 9 and later. The old package used the Option name PlotLegend while the new one uses PlotLegends, which I admit is confusing. The second problem is ...


4

Does this work for you? data=Import[["iso-pair-data.csv"]; vals = Table[Transpose[{data[[All, 1]], data[[All, i]]}], {i, 2, Length@First@data}]; ListLinePlot[vals, Joined -> True, PlotRange -> {Automatic, {0, Max[data[[All, 2 ;;]]]}}, ImageSize -> Large]


0

Using Bill's answer but adding Epilog[] for labeling, try f1[x_] := x^2; f2[x_] := x^4; Manipulate[ Plot[{f1[x + n], f2[x + n]}, {x, 0.0001, 1}, PlotStyle -> {Red, Blue}, PlotRange -> {-10, 10}, Epilog -> { (Text[ Style["f1", FontFamily -> "Times New Roman", FontSize -> 10, Red], {.6, f1[n + .6] + .6}]), (Text[ ...


0

just for the sake of variety, here is another approach. From your problem it looks like you have an equation relating three variables and you want to choose two of them as variable. In most practical cases it is quite useful to treat the third variable as a parameter and take some trial value for that. Now say you have three variables x,y,z and you want a ...


3

In version 10.0.0 the PlotStyle -> Thickness method shown by cormullion does not appear to work. Instead we can use the undocumented Extrusion option: ContourPlot3D[x y z == 0.05, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, Extrusion -> 0.1]


6

Building on Pickett's answer with a few more Options: pl = Plot3D[-(x - 12.5)^3, {x, 0, 25}, {y, 0, 20}, MeshShading -> {Table[Hue[x], {x, 0, 1, 1/16}]}, BoxRatios -> 1, Boxed -> False, FaceGrids -> {{0, 1, 0}, {-1, 0, 0}, {0, 0, -1}}, FaceGridsStyle -> Directive[Thick, Gray, Dotted] ] It's not perfect but hopefully it points you ...


2

I might sound terribly pedantic here, but the answer is simply: Not at all. The problem is that you have a finite set of data points, none of which has a y-value of 0.29. So there is no 'intersection' between a constant line and a number of points. The other two answers above gave you a solution on how to find the intersection between the horizontal line ...


2

p1 = ContourPlot[r^2 + c^2, {r, -2, 2}, {c, -2, 2}, ContourLabels -> Function[{x, y, z}, Text[Framed[z], {x, y}, Background -> White]], ImageSize -> 400, PlotLegends -> Automatic]; p2 = Plot3D[r^2 + c^2, {r, -2, 2}, {c, -2, 2}, MeshFunctions -> {#3 &}, Mesh -> 7, MeshShading -> {Blue, LightBlue}, ImageSize -> ...


8

Try using MeshShading: Plot3D[ -(x - 12.5)^3, {x, 0, 25}, {y, 0, 20}, MeshShading -> {Table[Hue[x], {x, 0, 1, 1/16}]} ] The Table part generates sixteen different colors from the Hue color function. I did this because the image in this case had sixteen rows. If there are more rows than colors the colors will be reused cyclically.


1

Using this function: data = {{0.2*10^4, 0.57}, {0.6*10^3, 0.56}, {0.2*10^3, 0.55}, {0.6*10^2, 0.53}, {0.2*10^2, 0.49}, {6, 0.44}, {2, 0.38}, {0.6, 0.33}, {0.2, 0.23}}; f = Interpolation[data, InterpolationOrder -> 1]; y[x_] := 0.29 x0 = First[x /. FindRoot[f[x] - y[x], {x, #[[1, 1]], #[[2, 1]]}] & /@ ...


0

Are you wanting to do this numerically or is symbolically fine for you? If so how about implicit differentiation: Solve[D[w + 1/(x^2 + y^2) + 1/(x z[w]) == 2y, w], z'[w]] (* {{z'[w] -> x z[w]^2}} *)


3

As shown by the graphic, the Log is applied on the y-axis, thus you need to apply Log to the y coordinate of your point: LogPlot[Sin[x], {x, 0, π}, Epilog -> {Text["x", {π/2, Log@0.2}]}] For completeness purposes as suggested by rcollyer: LogLinearPlot[Tanh[x], {x, 1, 100}, Epilog -> {Text["x", {Log@10, 0.98}]}] LogLogPlot[ Sum[i/(x^2 - 2 i ...


6

A working way to use Directive: ContourPlot[Cos[x] + Cos[y], {x, 0, 4 Pi}, {y, 0, 4 Pi}, ContourShading -> False, ContourStyle -> Array[Directive[Thick, ColorData[10]@#] &, 10] ] Changing thickness along with color: ContourPlot[Cos[x] + Cos[y], {x, 0, 4 Pi}, {y, 0, 4 Pi}, ContourShading -> False, ContourStyle -> ...


6

You could use BaseStyle to set the Thick lines: ContourPlot[x y, {x, -1, 1}, {y, -1, 1}, ContourShading -> False, ContourStyle -> ColorData[10] /@ Range[10], BaseStyle -> Thick] Alternatively you could Thread Directive over the colour list: ContourStyle -> Thread @ Directive[Thick, ColorData[10] /@ Range[10]] which will give the same ...


0

Use Directive ContourPlot[x+y,{x,-1,1},{y,-1,1},ContourShading->False,Contours->Range[1,10],ContourStyle->Directive[Thick,Red]]


1

If you change your last function just to expression and evaluate in plot: exp = (1 - y[Te, w]) Pprobe == (Te - Tb) Geb; ContourPlot3D[ Evaluate[exp], {w, 0, 5*10^9}, {Te, 0, 1}, {Pprobe, 0, 10^-14}, Mesh -> False]


1

For illustrative purpose (please also search site and documentation): toy = Table[{j, j^2 + RandomReal[{-3, 3}]}, {j, -4, 4, 0.1}]; mod = LinearModelFit[toy, {1, x, x^2}, x]; lp = ListPlot[toy, PlotStyle -> Red]; modp = Plot[mod[x], {x, -4, 4}, PlotStyle -> Blue]; lgnd = Framed[ Column[{PointLegend[{Red}, {"data"}], LineLegend[{Blue}, ...



Top 50 recent answers are included