Tag Info

Hot answers tagged

19

First define the Morse code (from rosettacode.org with corrections by @evanb) morsecode = (#1 -> Characters[#2]) & @@@ { {"a", ".-"}, {"b", "-..."}, {"c", "-.-."}, {"d", "-.."}, {"e", "."}, {"f", "..-."}, {"g", "--."}, {"h", "...."}, {"i", ".."}, {"j", ".---"}, {"k", "-.-"}, {"l", ".-.."}, {"m", "--"}, {"n", "-."}, {"o", "---"}, ...


15

Your comment raises interesting question: I got everything simply faded and flat, while in the example - its all bright and sharp I think the problem is related to the fact that Mathematica's graphical functions always work in linear colorspace. Starting from Pickett's solution with better resampling method, in version 10.0.1 we obtain: ...


9

On-screen, lines are always at least 1 pixel wide in Mathematica, regardless of the thickness setting. Not sure what you tried with Opacity, as it seems to be possible to achieve the same effect: PlotStyle -> Directive[AbsoluteThickness[1], Opacity[.05]]


6

You tried to decrease the width of the lines to below the minimum width. In order to achieve the same effect you can increase the size of the image instead. x = RandomReal[1, 10000]; y = RandomReal[1, 10000]; Show[ImageResize[Rasterize@ListLinePlot[{Thread@{x, y}}, ImageSize -> 10000], 300], ImageSize -> 300]


5

You have the import. dates = Import["http://www.sudomemo.net/statistics/firstSeenDump.php", "JSON"] Gather them up by day and count how many in each day. dailyGather = GatherBy[dates, Take[DateList[#], 3] &]; dailyVisits = {Take[DateList[dailyGather[[#, 1]]], 3],Length[dailyGather[[#]]]} & /@ Range[First@Dimensions[dailyGather]]; Plot the ...


5

You're about to realize that derivatives in the real world are a pain. You have to aggregate data as much as possible and average it a lot until you get a "textbook-quality second-derivative! dates = DateList /@ Import["http://www.sudomemo.net/statistics/firstSeenDump.php", "JSON"] Grouping by days and counting: datesDays = Tally@dates[[All, ;; 3]]; ...


5

Rolled back to the very first version: ClearAll[x]; Plot[Evaluate[Range[50] + x], {x, -5, 5}, PlotLegends -> "Expressions"] Update -2: For other users who might have liked the deleted version: Plot[Evaluate[{1, 2, 3, " ... ", 49, 50} + x], {x, -5, 5}, PlotLegends -> "Expressions"] ... and a few variations: Plot[Evaluate[Range[50] + x], {x, ...


4

Try this: Plot[Tooltip[{n!, n^n, Exp[n], Log[n], n^100, 10^n}], {n, 0, 2}] Now when you hover over the plot, the tooltip (the little popup window) tells which curve the mouse is pointing at.


4

If it is to be printed and you have space (say, a page), then a grid can be effective, where each dataset is plotted in a highlight color over a monochromatic plot of all datasets: maxmin = {Min /@ Transpose[data], Max /@ Transpose[data]}; background = ListLinePlot[Join[maxmin, data], PlotStyle -> Directive[Thin, Gray], Filling -> {1 -> ...


4

data = RandomInteger[10, {20, 20}]; ticklabels = StringJoin /@ # & /@ RandomChoice[CharacterRange["A", "Z"], {2, 20, 3}]; ticklabels2 = MapAt[Rotate[#, Pi/2] &, ticklabels, {2, All}]; ticks = (MapIndexed[{First@#2, #1} &, #] & /@ ticklabels2); ticks2 = {{ticks[[1]], None}, {None, ticks[[2]]}}; ArrayPlot[data, FrameTicks -> ticks2] ...


4

You can specify the decimal point using the Numberpoint option, like described here: Import["file.txt", "Table", "NumberPoint" -> ","]


3

Try this idea: Plot[If[x < 0, Integrate[Exp[x*z^2], {z, -\[Infinity], \[Infinity]}], None], {x, -1, 1}] Within this example you will get the following plot: Have fun!


3

It seems AxesOrigin property spoils everything. A bug maybe.. I can suggest 2 way outs: first, simply: Graphics3D[{arrowAxes[3], Sphere[{1, 1, 1}]}, Axes -> True, Boxed -> False, AxesEdge -> {{0, -1}, {0, -1}, {0, -1}}, AxesStyle -> Opacity[0], TicksStyle -> Opacity[1]] This gives what you want, but i don't know how to specify the ...


3

results = Sort@RandomInteger[100, {20, 30}]; Columns 2, 5 and 12 versus 1: ListLinePlot[results[[All, {1, #}]] & /@ {2, 5, 12}, PlotLegends -> Placed[Row[{"n = ", #}] & /@ {2, 5, 12}, Right]] columns = {2, 3, 15, 20}; ListLinePlot[results[[All, {1, #}]] & /@ columns, PlotLegends -> Placed[Row[{"n = ", #}] & /@ columns, ...


3

is this what you want? tikc1 = {r1, r2, r3}; htick = {#, Style[tikc1[[#]], 14, Bold]} & /@ Range[3]; tikc2 = {c1, c2, c3, c4}; vtick = {#, Style[Rotate[tikc2[[#]], Pi/2], Bold, Red, 14]} & /@ Range[4]; ArrayPlot[{{1, 0, 0, 0.3}, {1, 1, 0, 0.3}, {1, 0, 1, 0.7}}, FrameTicks -> {htick, vtick, htick, vtick}]


3

As you expect monotonic "smooth" behavior, a simple solution is to z-score the differences. diff = data[[All, 2]] // Differences; mn = Mean[diff] std = StandardDeviation[diff] (* 3 std is bad *) bad = Position[diff, x_ /; Abs[x] > Abs[mn + 3 std]] ListPlot[data, PlotRange -> All] ListPlot[data[[bad // Flatten]], PlotStyle -> Red] Show[%, %%] ...


3

funcs = Tooltip /@ ({E^x, (Series[E^x, {x, 0, #}] // Normal) & /@ Range[6]} // Flatten); Plot[funcs, {x, 0, 5}]


3

You can also specify your own plot styles and for functions with large ranges consider LogPlot, e.g. LogPlot[{n!, n^n, Exp[n], Log[n], n^100, 10^n}, {n, 0, 2}, PlotStyle -> {{Red, Dashing[{0.03, 0.03}]}, Green, Blue, Orange, {Purple, Dashing[{0.03, 0.03}]}, Black}, PlotLegends -> "Expressions"]


3

It's simpler than you fear. First the command is ContourPlot... for a simple g, this will give you the circle of radius 1. g[x_, y_] := x^2 + y^2; ContourPlot[g[x, y] == 1, {x, -2, 2}, {y, -2, 2}] Now say you have the two functions f1 and f2 f1[x_] := Log[x]; f2[y_] := Exp[y]; ContourPlot[g[f1[x], f2[y]] == 1, {x, -2, 2}, {y, -2, 2}] Now you get the ...


2

Assuming you really want solid lines for your data, I'd suggest something like the following. ListLinePlot[fakedata, PlotStyle -> (Flatten@ Outer[Directive, {AbsoluteThickness[1.5], Dashing[0.02], DotDashed, Dotted}, Take[ColorData[22, "ColorList"], 5]])] For shorter data series in the data set, PlotMarkers can help if you truncate your ...


2

Use #3 instead of #. See the RegionFunction -> docs, "Details" section- f[x_] := Sin@ x g[x_] := x^2; ParametricPlot[{g@x, f@x}, {x, 0, 3}, RegionFunction -> (! 1 < #3 < 2 &), AspectRatio -> 1]


2

A common approach to removing outliers is to use an order statistic filter. The simplest of these is the MedianFilter: x = data[[All, 1]]; ySmoothed = MedianFilter[data[[All, 2]], 5]; ListPlot[Transpose[{x, ySmoothed}]]


2

ContourPlot[Min[(-7 + 100 t - x) (5 + 100 t - x), (400 t^2 + 40 t (-5 + x) + (-5 + x) (7 + x))], {t, 0, .05}, {x, -1, 5}, PlotRange -> All, Exclusions -> None] Exclusions->None fixes the issue in both version 9 and 10: Without the Exclusions->None option, I reproduce the issue in both versions (Windows 8 - 64bit):


2

n = 20 (*even*) f = Interpolation[Transpose[{data[[All, 1]], Join[ data[[;; (n/2 - 1), 2]] , MovingAverage[data[[All, 2]], n] , data[[-n/2 ;;, 2]] ]}]] GraphicsColumn[{ListPlot[data], ListPlot[ Select[ data , Abs[f[#[[1]]] - #[[2]]] < .2 & ] ]}]


2

Perhaps this is your aim: tsv = ImportString["0,000000000E0 1,237909063E1 3,333333333E-2 1,237909063E1 6,666666667E-2 1,237909063E1 1,000000000E-1 1,240163557E1 1,333333333E-1 1,267077663E1 1,666666667E-1 1,309703315E1 2,000000000E-1 1,363531527E1 2,333333333E-1 1,390445633E1 2,666666667E-1 1,448782832E1 3,000000000E-1 ...


2

I'll use a simpler form for an example. One can keep track of the least value that has given an error/warning message in a variable. It can be set whenever a message is generated using Check. The use of Quiet is optional. You may want to limit the messages that trigger a Check or that are suppressed by Quiet. See their documentation for more. I also ...


2

There are some good links about this topic https://reference.wolfram.com/language/ref/Plot.html http://reference.wolfram.com/language/howto/PlotFunctionsOfOneVariable.html http://reference.wolfram.com/language/howto/PlotFunctionsOfTwoVariables.html http://reference.wolfram.com/language/howto/PlotAGraph.html Plot[-2 x^2 - 4 x - 3, {x, -10, 10}] f[x_] := ...


2

Insert a Null (or anything that's not a real number) where you want a gap. ListLinePlot[{{0, 0}, {1, 0}, {2, 0}, Null, {3, 5}, {4, 6}, {5, 7}}]


2

Let's call $u=f_1(x)$ and $v=f_2(y)$. Do you want to plot $g(u,v)=1$ against $x$ and $y$, or $g(x,y)=1$ against $u$ and $v$? @bill's answer does the former. Here's a way to do the latter: Use ParametricPlot, and define the contour using MeshFunctions. f1[x_] := Log[1 + x] f2[y_] := Exp[y] - 1 g[x_, y_] := x^2 + y^2 ParametricPlot[{f1[x], f2[y]}, {x, -1.2, ...


1

I just changed your code a little bit, to TickStyle->None arrowAxes[arrowLength_] := Map[{Apply[RGBColor, #], Arrow[Tube[{{0, 0, 0}, #}]]} &, arrowLength IdentityMatrix[3]]; Graphics3D[{Sphere[{1, 1, 1}], arrowAxes[3]}, Axes -> True, Boxed -> False, AxesOrigin -> {0, 0, 0}, AxesStyle -> Opacity[0], TicksStyle -> None]



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