Tag Info

Hot answers tagged

18

Taking the cube root on both sides fixes the problem, and then you don't need lots of PlotPoints any more. ContourPlot3D[(x^2 + 9/4 y^2 + z^2 - 1) == CubeRoot[x^2 z^3 + 9/80 y^2 z^3], {x, -6/5, 6/5}, {y, -6/5, 6/5}, {z, -6/5, 3/2}, Mesh -> None, Boxed -> False, AxesLabel -> {"x", "y", "z"}, Axes -> False, ContourStyle -> Directive[Red, ...


13

In Version 10 you can use the PlotTheme "OpenMarkersThick": data = Table[{x, x^k}, {k, 1, 4}, {x, 0, 1, 0.1}] ListLinePlot[data, PlotTheme -> {"OpenMarkersThick", "LargeLabels"}, PlotLegends -> {x, x^2, x^3, x^4}]


11

\[FilledSquare] is a font glyph and you cannot color parts of it. I believe you need to draw your markers with Graphics primitives. For example: square[in_, out_: Black, size_: 12] := Graphics[{in, EdgeForm[{AbsoluteThickness[2], out}], Rectangle[]}, PlotRangePadding -> 0, ImageSize -> size] data = {{1, 2, 3, 5, 8}, {2, 3, 6, 9, 10}, {4, ...


10

NB I think there's a problem with this code, please see this answer by ubpdqn for more information. I'll update these snippets when I get the chance. Yours is a question with many possible interpretations. I've chosen the interpretation that was most fun for me to play with, so... ang = 20; (* divide the world into chunks of this size *) pts = ...


7

Tube is helpful in this regard, for example: tube[r_, l_, rt_] := Graphics3D[{CapForm["Square"], Tube[Join[Table[{-1, 0, j}, {j, l, 0, -0.1}], Table[-{Cos[t], 0, Sin[t]}, {t, 0, Pi, 0.1}], Table[{1, 0, j}, {j, 0, rt, 0.1}]], r]}, Boxed -> False] Visualizing: Manipulate[tube[i, j, k], {i, 0.1, 0.5}, {j, 0.5, 2}, {k, 0.5, 2}] You can ...


6

This uses some version 10 functions: Getting the data (takes time as I could have set this up better): dat = Table[{i, j, WeatherData[{j, i}, #] & /@ {"WindSpeed", "WindDirection"}}, {i, 113, 153, 4}, {j, -43, -11, 4}]; Processing: data = Cases[{{#1, #2}, -QuantityMagnitude[#3[[1]]] {1/Cos[#2 Degree], 1} Through[{Sin, ...


6

Here is an example with some random data: SeedRandom@0; dat = Sort /@ RandomInteger[{200, 700}, {3, 25}]; Graphics[{Hue@.5, Opacity@.7, MapIndexed[Line@Outer[List, #, 40 #2[[1]] + {20, -20}] &, dat]}, Axes -> {True, True}, Ticks -> {Automatic, Thread@{Range[40, 3*40, 40], Range@3}}] With your data, it's a different story and it looks ...


5

You may use: center[gr_Graphics] := Show[gr, AxesOrigin -> {Mean @ First @ PlotRange @ gr, 0}] Example: dat = Table[TriangleWave[x] + RandomReal[0.3], {x, 3/4, 7/4, 0.01}]; ListPlot[dat] // center The code above assumes you want to place the horizontal axis at zero. You could use Automatic instead for default placement, or if you wish to center ...


5

This issue arises due to the introduction of PlotTheme in Mma v10. You can disable this behaviour by using PlotTheme -> None, e.g. Plot[{x^2 + x, x^2}, {x, -1, 1}, BaseStyle -> AbsoluteThickness[4], PlotTheme -> None] If you have multiple plots in your notebook, than you can execute $PlotTheme=None; somewhere before the plots to get the old ...


5

Want to plot a region defined by an inequality? Just use RegionPlot. z = x + I y; p1 = 1 + z; p2 = 1 + z + 1/2 z^2; RegionPlot[{Abs[p1] <= 1, Abs[p2] <= 1}, {x, -2.5, 0.5}, {y, -2, 2}, AspectRatio -> Automatic] If you just want the boundary contours, use ContourPlot[{Abs[p1] == 1, Abs[p2] == 1}, ... instead. Oh hey check it out: p[z_, n_] ...


4

This is in theory pretty simple. Think of it as two separated steps. First, you need function that models your extrusion-thickness, which has in the middle always the same value and at both ends it should round up like a circle. You can do this with Piecewise or, as I show here, with a combination of Heaviside functions: thicknessFunc[z_, body_] := ...


4

DistributionChart with ChartElementFunction->"LineDensity" spktrnF[data_, opts : OptionsPattern[]] := Module[{options = {ChartBaseStyle -> EdgeForm[None], ChartElementFunction -> "LineDensity", BarOrigin -> Left, BarSpacing -> 0.1, ChartLabels -> Range[Length@data]}}, ...


4

You could use ArrayPlot. t = Flatten @ Import["f:\\spikes.dat"]; p = ConstantArray[0, Max[t]]; p[[t]] = 1; ArrayPlot[{p[[1 ;; 1000]], p[[1000 ;; 2000]]}, AspectRatio -> 1/10, FrameTicks -> Automatic, FrameLabel -> {"neuron", "time"}] But this approach is bad for data with more than 1000 time records


4

Rather than turning off the Theme capability you could work with it: Plot[{x^2 + x, x^2}, {x, -1, 1}, PlotTheme -> "ThickLines"] You can combine Themes allowing additional control. To learn how to create new Themes such as "Thick5" see the Advanced section of my answer to: Is it possible to define new PlotTheme? Example of use: Plot[{x^2 + x, ...


4

I feel a bit foolish posting such a simple answer after the two complete examples above, but I think it bears pointing out that version 10 includes a function specifically for removing Missing values: DeleteMissing:


4

Although Overlay preserves unrasterized copies of its constituent Graphics it is rasterized by the Front End for the purpose of display. Therefore I do not believe that you can use Overlay for this purpose. However, I believe you can use Epilog and Inset: p1 = Plot[Sinc[x], {x, 0, 10}]; p2 = BarChart[{{1, 2, 3}, {1, 3, 2}}]; Show[p1, ImageSize -> ...


4

You have somehow to segment your data. Here you could use the radius + FindClusters: radius = 14.6; data1 = FindClusters[Select[data, Norm[#] > radius &], 2,Method -> "Agglomerate"]; Show[ ListPlot[data1, PlotRange -> Full, AspectRatio -> 1, PlotStyle -> {Green, Red}], ListPlot[Select[data, Norm[#] < radius ...


3

ParametricPlot3D and ParametricPlot accept a wide range of nested lists of expressions to specify a function or functions to be graphed. Let's discuss ParametricPlot3D. ParametricPlot is similar, with lists of length 2 replacing lists of length 3 where appropriate. There are two types of specifications List[expr,...] List[List[...],...] where expr ...


3

An alternative to manually setting line breaks is to set a label size and then let the label break as needed: Plot[Cos[2 x], {x, -Pi, Pi}, Frame -> True, FrameLabel -> {{Pane["This is a y frame label", {50, All}], None}, {Pane["This is an x frame label", {50, All}], None}}]


3

Plot[Table[ConditionalExpression[C*r^2 + 2 C, r >= C], {C, {25, 100, 150, 300}}] // Evaluate, {r, 0, 500}, PlotLegends -> LineLegend[{25, 100, 150, 300}, LegendLabel -> C, LabelStyle -> {GrayLevel[0.2], Bold, 10}, LegendFunction -> "Frame"], AxesLabel ...


3

Using VertexColors is efficient if there are many points. SeedRandom[1]; pts = RandomReal[1, {100, 3}]; Post-process ListPointPlot3D: ListPointPlot3D[pts, PlotStyle -> PointSize[Large]] /. Point[pp_] :> Point[pp, VertexColors -> (Blend[{Yellow, Brown}, #] & /@ Rescale@Range@Length[pp])] Or directly with Graphics3D: ...


3

per my comment, without DataRange ListContourPlot[Table[Sin[i + j^2], {i, 0, 3, 3/128}, {j, 0, 3, 3/128}]] ...and with ListContourPlot[Table[Sin[i + j^2], {i, 0, 3, 3/128}, {j, 0, 3, 3/128}], DataRange -> {{-150, 150}, {-150, 150}}]


3

In V10, with the new association objects, it is easy to implement what you want with ListPointPlot3D What is needed is a hash map (which is my mental image of an association) that maps your list of points into index values for Blend. This can be built with AssociationThread. Consider pts = RandomInteger[99, {100, 3}]; indxs = AssociationThread[pts, Range @ ...


3

You just need to add Opacity to your first plot: pt1=ParametricPlot3D[{Sin[θ], y, Cos[θ]}, {θ, 0, 2 Pi}, {y, 0, 2 Pi}, PlotRange -> {{-2, 2}, {0, 2 Pi}, {-2, 2}}, BoxRatios -> {1, 3/2, 1}, Boxed -> False, AxesOrigin -> {0, 0, 0}, AxesLabel -> {x, y, z}, Mesh -> None, AxesStyle -> Arrowheads[{0.1, 0.1, 0.2}], ColorFunction ...


3

I think I accidentally found something interesting that seemed to be never mentioned in this site according to my quick search. Before demonstrating it let me answer OP's question first, as @Chenminqi mentioned in the comment, to add the asymptote to your plot, what you need is 1/f[x] == 0 rather than f[x] == 0, because what f[x] == 0 represents is the cross ...


3

You could build your own PlotMarkers ngon[p_, q_] := Polygon[Table[{Cos[2 Pi k q/p], Sin[2 Pi k q/p]}, {k, p}]] g1 = Graphics[{EdgeForm[Black], White, Disk[{0, 0}, 1]}]; g2 = Graphics[{EdgeForm[Black], White, Rectangle[{1, 1}]}]; g3 = Graphics[{EdgeForm[Black], White, ngon[4, 1]}]; g4 = Graphics[{EdgeForm[Black], White, Polygon[{{1, 0}, {0, Sqrt[3]}, ...


3

Please tell me if this produces what you expect: link[a : {{_, _} ..}, b : {{_, _} ..}] := Join[a, (b\[Transpose] - First[b] + Last[a])\[Transpose]] link[x__] := Fold[link, {x}] gp1fix = gp1 /. Line[x_] :> Line[link @@ Split[x, EuclideanDistance[##] < 1 &]]; Show[gp1fix, gp2, Axes -> False, Frame -> True, FrameStyle -> ...


3

Though I was expecting to need something fancy I stumbled upon a simple solution: ListLinePlot[data, PlotMarkers -> Graphics[{Disk[]}, ImageSize -> 13], PlotLegends -> Automatic ] The only change is enclosing Disk[] in { }. Looking at the InputForm we see that expressions involving Disk have been changed to e.g.: Graphics[{ Hue[0.67, ...


2

Doing this with ListPointPlot3D is not very straightforward, but do look at the answer by m_goldberg. However, ListPointPlot3D is trivial to re-implement in terms of graphics primitives. Here's one way to colour based on index: pts = RandomReal[1, {10, 3}]; Graphics3D[ {PointSize[Large], MapIndexed[{Blend[{Yellow, Brown}, First[#2]/Length[pts]], ...


2

You can use Export[] when you cannot select outputs in the Front End. Overlay[{p1, Item[Show[p2], Alignment -> {-.7, .6}]}] Export["graphics.pdf",%] saves the graphics as PDF in your current working directory. No rasterization happens. This technique can also be used for output of GraphicsRow, GraphicsColumn, and GraphicsGrid where you cannot select ...



Only top voted, non community-wiki answers of a minimum length are eligible