BLI
July 1, 2019, 12:51pm
1
I’m plotting tiny subplots in a 4x4 matrix. Some of the subplots contain a large number of digits… making the plot really ugly:
I’m trying to map the trunc()
function on the plots, e.g.,
x = ...
Y = ...
fg = []
for i in 1:15
push!(fg,plot(x,trunc.(Y[i];digits=2)))
end
plot(fg...)
But it seems arbitrary whether the values on the ordinate axes are displayed with 2 digits or 1 digit or a large number of digits, etc.
Is there a way around this?
Please make an MWE which includes, among other things, the backend.
Welcome to the Julia Discourse! We are enthusiastic about helping Julia programmers, both beginner and experienced. This public service announcement (PSA) outlines best practices when asking for help. Following these points makes it easier for us to help you and more likely you’ll get a prompt, useful answer.
Keywords are highlighted to make it easier to refer to specific points.
Choose a descriptive title that captures the key part of your question, eg “plots with multiple axes” instead of …
BLI
July 1, 2019, 1:42pm
3
I’ll try to construct an MWE… not trivial – I plot results from the loss function of fitting various parameters to experimental data. If I use “nice” functions, the problem doesn’t appear, I think.
I suspect this is coming from an axes where numbers vary little. Also, the backend info may be useful, since it is not clear from your post.
BLI
July 1, 2019, 2:21pm
6
Ok? I ran a Pkg.update()
just before I took the screen shots today. Maybe the fix hasn’t been pushed out yet.
BLI
July 1, 2019, 2:24pm
7
I thought I used PyPlot… I then discovered that the statement was pyplot
instead of pyplot()
resulting in a defaulting to GR.
You can specify a function to format your ticks
f(x)= exp(x)
using Plots,Formatting
gr()
plot(f,0.0:0.01:1.5,yscale=:log10,xscale=:identity,
xformatter=x->format( x, precision=2 ),
yformatter=x->format( log(x), precision=2 ))
1 Like
This is a bug that has been fixed - it may not have been released yet.
BLI
July 2, 2019, 12:41pm
10
Superb! Looks beautiful!!