plots.jl

Plotly + Julia + Latex

六眼飞鱼酱① 提交于 2021-02-10 05:09:27
问题 I would like to use latex with the Plotly backend. Look in this example: Even the x-axis and y-axis log scales are not formatted properly! Do you know how to do that? Best, v. using Plots, LaTeXStrings plotlyjs() x = 10 .^ LinRange(-5,5,10) plot(x, 1 ./ x, yaxis=:log, xaxis=:log, m = 2, xlabel="x", label="1/x",ylabel="f(x)") plot!(x, 10 ./ x, m=2,label="10/x") plot!(x, 1 ./ (x.^2), m=2, label=L"f(x)=$1/x^2$") savefig("./test.png") 回答1: Seems to work with the gr() backend, so I expect

How to scale the fontsizes using Plots.jl

梦想与她 提交于 2021-01-28 01:36:02
问题 is there a way to rescale all the fontsizes (legend, tickslabels, axislabels…) at once? Original question from Filippo Vicentini on Slack. 回答1: Individual font sizes can be controlled with the titlefontsize , tickfontsize , legendfontsize , tickfontsize , guidefontsize and legendtitlefontsize attributes, but I get that this can be quite tedious. There is also the thickness_scaling attribute. plot(rand(10), thickness_scaling = 0.5) However, this also affects the line widths. The third option

How do you color (x,y) scatter plots according to values in z using Plots.jl?

…衆ロ難τιáo~ 提交于 2019-12-23 12:19:27
问题 Using the Plots.jl package in Julia, I am able to use various backends to make a scatter plot based on two vectors x and y k = 100 x = rand(k) y = rand(k) scatter(x, y) I am unable to find information about how to color them according to some length k vector z . How do you do that? 回答1: The following method will be much better than jverzani's (you don't want to create a new series for every data point). Plots could use some additional love for manually defining color vectors, but right now

Julia PyPlot: plot 3D surface with as face colors the norm of surface gradient

可紊 提交于 2019-12-23 08:56:56
问题 Does anyone know how to plot a 3D surface with Julia's Pyplot with e.g the norm of the surface-gradient as the face color? Similar to this topic for Python: Color matplotlib plot_surface command with surface gradient 回答1: I saw this and I just HAD to make it work. It was almost supported out of the box with Plots.jl, using the PyPlot backend. I just had to swap out for a custom matplotlib shader to apply a different z-matrix. You'll notice that I'm accessing numpy's gradient function

Accessing backend specific functionality with Julia Plots

我怕爱的太早我们不能终老 提交于 2019-12-12 10:38:49
问题 Plots is simple and powerful but sometimes I would like to have a little bit more control over individual elements of the plot to fine-tune its appearance. Is it possible to update the plot object of the backend directly? E.g., for the default pyplot backend, I tried using Plots p = plot(sin) p.o[:axes][1][:xaxis][:set_ticks_position]("top") but the plot does not change. Calling p.o[:show]() afterwards does not help, either. In other words: Is there a way to use the PyPlot interface for a

How to overlay contour plots in Julia (using Plots with PyPlot backend)

偶尔善良 提交于 2019-12-11 15:15:38
问题 I'm trying to overlay two contour plots in Julia using Plots with PyPlot backend. Is it possible, and, if so, how? An MWE could look something like this: using Plots pyplot() a = rand(50,50) b = rand(50,50) p1 = contour(a,seriescolor=:blues) p2 = contour(b,seriescolor=:reds) plot(p1,p2,layout=1) (This code generates ERROR: When doing layout, n (1) != n_override (2) . I do understand the error, but I do not know how to get around it.) 回答1: Solution Use contour! : using Plots pyplot() a = rand

How plot on Images with Plots.jl?

天大地大妈咪最大 提交于 2019-12-10 11:06:49
问题 I want using Plots.jl for plot on Images, for example simple sinusoid. Here my code: using Plots using Images gr() h = 400 w = 600 a = Array(RGB{FixedPointNumbers.UFixed{UInt8,8}}, h, w) img = Image(a) p=plot(img) x = collect(0:0.1:2π) plot!(x,sin(x)) png("Test") But I get wrong result. How do this correctly? 回答1: Here's a quick example that I hope gives you some clues: julia> plot(img) julia> plot!(x->200sin(.05x)+300, 0, 700, w=5) You probably just want to ensure that you're plotting to the

How plot on Images with Plots.jl?

人盡茶涼 提交于 2019-12-06 10:46:43
I want using Plots.jl for plot on Images, for example simple sinusoid. Here my code: using Plots using Images gr() h = 400 w = 600 a = Array(RGB{FixedPointNumbers.UFixed{UInt8,8}}, h, w) img = Image(a) p=plot(img) x = collect(0:0.1:2π) plot!(x,sin(x)) png("Test") But I get wrong result. How do this correctly? Here's a quick example that I hope gives you some clues: julia> plot(img) julia> plot!(x->200sin(.05x)+300, 0, 700, w=5) You probably just want to ensure that you're plotting to the right coordinates that match the image. 来源: https://stackoverflow.com/questions/41704558/how-plot-on-images