# Tag Info

41

One possibility is to plot the contour plot with linear scales using ContourPlot and use ListLogLogPlot to transform this plot to one with logarithmic scales: pl = Normal@ ContourPlot[ Sin[3 x] + Cos[3 y] == 1/2, {x, .01 Pi, 3 Pi}, {y, .01 Pi, 3 Pi}, PlotPoints -> 30] ListLogLogPlot[Cases[pl, Line[a_, b___] :> a, Infinity], Joined -> ...

40

Giving the density plot a logarithmic scale must always involve - unless some future version of Mathematica includes it by default - overriding the ColorFunctionScaling of the original plotting command and supplying a custom scaling function. The simplest logarithmic scaling is of the form  \mathrm{scaling}(x)=\frac{\log(x/\mathrm{min})}{\log(\mathrm{max}/ ...

28

Instead of doing some transformation on the original ContourPlot we can do an exponential rescaling of the original variables in the ContourPlot, so this is somewhat different approach to get roughly the same result : ContourPlot[ Sin[ 3 Exp@x] + Cos[ 3 Exp@y ] == 1/2, {x, Log[0.01 Pi], Log[3 Pi]}, {y, Log[0.01 Pi], Log[3 Pi]}, PlotPoints -&...

27

Edit: The new package to install for this comes from the CustomTicks subpackage of the SciDraw package (formerly, LevelScheme). You first have to install the SciDraw package, it's worth it if you produce a lot of figures. You can see how to do it on the SciDraw guide. Load the package that you will be using Get["CustomTicks"] Assign a function and do ...

27

Reproduced in v.10.0.0 under Win7 x64. In versions 8.0.4 and 9.0.1 the behavior differs in details but the bug is also present: only major logarithmic frame ticks change their thickness, but not minor ticks. Let us elaborate. First of all, in v.10 the logarithmic tick specifications are generated dynamically when the plot is rendered by the FrontEnd by ...

21

Writing one wouldn't be that hard. You can convert it to Log10 and then let FindDivisions do all the work in log space before converting it back. For example: findLogDivisions[{xmin_, xmax_}, n_Integer] := 10^FindDivisions[Log10@{xmin, xmax}, n] Then, to find 4 "nice" divisions in log space between 1 and 1000, you simply need to do: findLogDivisions[{1, ...

21

Ok, here's a very brief toy example while I don't have access to my desktop computer at work. It's easy enough to figure out, that a LogPlot of f is basically the plot of Log[f[x]]. And A LogLinearPlot is the plot of f[Exp[x]]. But we can extend this to arbitrary scalings of the axes. I start with defining a piecewise function which maps x values between 0 ...

21

If you are comfortable using undocumented and unsupported functionality we can do this with a ScalingFunctions option as I did for ListLogLinearPlot for the whole real numbers. (* listability *) (self : fn[off_, scale_])[x_List] := self /@ x (self : invfn[off_, scale_])[x_List] := self /@ x fn[off_, scale_][x_?NumericQ] := If[x < off, Log[x], x/...

20

This is not simply a mislabeling of the axes. More than that is going on: the plot produced is not even logarithmic. Let's try to use the default (non-log-transformed tick marks): First, with MachinePrecision (correct result): Show[ LogPlot[Abs[E^x - poly], {x, -1, 1}, WorkingPrecision -> MachinePrecision], Ticks -> Automatic ] Then with higher ...

18

EDIT: After 3 years, it has been discovered that this oft-linked-to answer doesn't truly space logarithmically. It's close, which was all I was going for at the time (and handles zeros), but it's not quite right. Anyway, thanks to @Pickett's careful moderation, here's a better version... logspace[increments_, start_?Positive, end_?Positive] := Exp@Range[...

18

Now that specifying a GridLines function has been repaired we can use this: logticks[a_, b_] := First /@ ChartingScaledTicks[{Log, Exp}][a, b] // Exp; Note that a slightly different option value is needed for each plot type. One could make these options the default using SetOptions, but if you prefer to keep the existing default and simplify application ...

15

As a slight variation of the nice suggestion above add FrameTicks to get the tick labels you want. ContourPlot[ Sin[3 Exp[x]] + Cos[3 Exp[y]] == 1/2, {x, Log[0.01 Pi], Log[3 Pi]}, {y, Log[0.01 Pi], Log[3 Pi]}, PlotPoints -> 30, FrameTicks -> {Table[{y, ToString[Round[10^y, 0.001]]}, {y, Log[10, 0.001], Log[10, 100]}], Table[{y, ...

13

One way is to plot the function 0 against a log axis. LogLogPlot[0, {t, 1, 12}, Axes -> {True, False}, Ticks -> {Range}] or, changing the numbers LogLogPlot[0, {t, 64, 96}, Axes -> {True, False}, Ticks -> {Range[64, 96]}] The Axis function turns off the vertical axis (because you just want the number line) and the Ticks specifies where ...

13

You can simply get the SmoothKernelDistribution and build the plot as you'd like: data = Table[Sin[x]^3 + 1, {x, 0, 6 Pi, 0.1}]; dist = SmoothKernelDistribution[data]; LogLogPlot[PDF[dist, x], {x, 0.01, 2}]

12

set = {8, 9, 10, 11, 12, 13, 14, 15, 16}; logset = Log[set]; resc = 2 Pi Rescale[logset]; f[u_] := {Sin[u], Cos[u]}; markers = Line[{f[#], 1.1 f[#]}] & /@ resc; labels = MapThread[ Text[#1, 1.2 f[#2]] &, {set /. {8 -> "16/8", 16 -> ""}, resc}]; Graphics[{Circle[], markers, labels}]

12

This is clearly a bug. In addition to the weird fence shape, the scaling behavior is also changed: fence widths change when the plot is resized. A work-around is to post-process the output to straighten the fence lines and make fence widths independent of image size: ClearAll[repairFences] repairFences[w_] := Replace[#, Line[x_] /; Length[Dimensions@x] == ...

11

LogTicks is really nice. However, if you might wish to avoid another package or have more control over the final output, here is a template. As mentioned in a comment above, I actually hope that ScalingFunctions will be fully implemented in the future. function[a_, b_] := Log[10, a + b] Plot3D[Log[10, function[#^10 &@a, #^10 &@b]], {a, Log10@1, ...

11

data = Table[PartitionsQ[n], {n, 50}]; epilog = {EdgeForm@Thick, FaceForm@None, Rectangle[{20, 500}, {40, 2000}]}; ListPlot[data, Epilog -> epilog] ListLogPlot[data, Epilog -> (epilog /. {x_, y_?NumericQ} :> {x, Log[y]})] ListLogLogPlot[data, Epilog -> (epilog /. {x_, y_?NumericQ} :> Log@{x, y})] Closely related topics: Asymmetric X ...

10

As of M11, you can use the ScalingFunctions option: ContourPlot[ Sin[3 x]+Cos[3 y]==1/2, {x,.01 Pi,3 Pi}, {y,.01 Pi,3 Pi}, ScalingFunctions->{"Log","Log"} ]

10

You can use ParametricPlot to transpose the axes by plotting $\{y,x\}$, and ScalingFunctions to get the log scale: ParametricPlot[{Abs[Gamma[x]], x}, {x, -5, 2}, PlotTheme -> "Business", ScalingFunctions -> {"Log", Identity}] Note that ScalingFunctions does not appear to be officially supported for *Plot functions so this should be regarded as ...

10

You can use a custom ScalingFunctions option for Plot instead. For example, here is a log plot: LogPlot[Abs[Gamma[z]], {z, -5, 5}] To reverse the y-axis use a custom ScalingFunctions option to Plot: Plot[Abs[Gamma[z]], {z, -5, 5}, ScalingFunctions -> {Minus @* Log, Exp @* Minus}]

9

You can simply use ScalingFunctions. (It appears red in version 10, but still works.) function = Log[10, a x + b /. a -> 1]; Plot3D[function, {x, 1, 3}, {b, 1, 3}, PlotLabel -> "Normal"] Plot3D[function, {x, 1, 3}, {b, 1, 3}, ScalingFunctions -> {Identity, Identity, "Log"}, PlotLabel -> "Log"]

9

Although Szabolcs warned "I don't think it's worth digging into how LogPlot works, as at this point this clearly seems to be a bug" I thought I would give a go. I found that: SystemLogPlot calls GraphicsLogPlotDumpscaledPlot which calls SystemPlot which calls SystemProtoPlotDumpiPlot which calls VisualizationCorePlot which is not readable. We can ...

9

The colors can be determined by the sign separately like this: colors = Sign[yData - 1] /. {1 -> Blue, -1 -> Red}; In order to change the color of the individual markers we have to change the Graphics object that ListLogPlot generates. We can view that expression using plot = ListLogPlot[ Transpose[{xData, Abs[yData - 1]}], Joined -> True, Mesh ...

8

With version 11, you can use the ScalingFunctions in both DensityPlot and BarLegend sf = Log[#/0.00003]/Log[1/0.00003] &; isf = InverseFunction[sf]; DensityPlot[Sinc[x]^2 Sinc[y]^2, {x, -20, 20}, {y, -20, 20}, PlotRange -> All, PlotPoints -> 100, ScalingFunctions -> {sf, isf}, ColorFunction -> "DeepSeaColors", PlotRange -> {0.00003, 1}...

8

The second argument to Histogram controls the bins, the third the counts so simply use Histogram[data, Automatic, "LogCount"] or as suggested by @Bill use "Linear" in place of Automatic.

8

LogPlot[x^x, {x, 1, 5}, GridLinesStyle -> LightGray, GridLines -> {Range, Flatten[Table[n, {n, 1 #, 9 #, 1 #}] & /@ (10^Range[0, 4])]}, Frame -> True]

8

You can, also, use GridLines -> Full option (in version 10.3, at least): LogPlot[x^x, {x, 1, 5}, GridLinesStyle -> LightGray, GridLines -> Full, Frame -> True]

8

Let us see how LogPlot in Mathematica 10.0.1 handles the default and custom Ticks specifications for the log-axis: Options[LogPlot[x^2, {x, 0, 10}], Ticks] Options[LogPlot[x^2, {x, 0, 10}, Ticks -> {Automatic, f}], Ticks] Options[LogPlot[x^2, {x, 0, 10}, Ticks -> {Automatic, f@## &}], Ticks] Options[LogPlot[x^2, {x, 0, 10}, Ticks -> {Automatic, ...

8

You can use VertexColors to color the individual points, since the points are all in a single Point in order. ListLogPlot[Transpose[{xData, Abs[yData - 1]}], Joined -> True, Mesh -> All] /. Point[p_] :> Point[p, VertexColors -> (Sign[yData - 1] /. {1 -> Black, -1 -> Red, 0 -> Blue})] Threw in the 0 case even though 0 won't be ...

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