logo
Tags down

shadow

Multi plots in Julia


By : lexey
Date : September 16 2020, 04:00 AM
may help you . Here is what I'd like to do : , As @crstnbr says, in Plots.jl you can do:
code :
using Plots
function L(v)
    v .* rand(100)
end;

p = plot()
for v in 1:4
    plot!(L(v), label="factor $v")
end
display(p)




Share : facebook icon twitter icon

Change x-axis limits on stratigraphic plots (ie. multi-panel plots)


By : remorina
Date : March 29 2020, 07:55 AM
this one helps. This is a quick part answer by tweaking the limits of the plot object and using the lattice Extra package to resize the panels
code :
# your data
library(analogue)
data(V12.122)
Depths <- as.numeric(rownames(V12.122))

(plt <- Stratiplot(Depths ~ O.univ + G.ruber + G.tenel + G.pacR,
                   data = V12.122,  type = c("h","l","g","smooth")))

# manually change the limits of second panel
# this auto updates ticks and labels
plt$x.limits[[2]] <- c(0.25,0.95) ;

# resize the panels 
latticeExtra::resizePanels(plt, w=c(5,5,5,5))

ggplot2() and gridExtra() - how to get uniformity between multi-plots and single plots?


By : alex
Date : March 29 2020, 07:55 AM
hop of those help? Here's an example of laying out the plots in a way that results in plots of similar size. I've also taken the liberty of putting your data frames and plots into lists to shorten the code:
code :
library(gridExtra)
library(ggplot2)

# List of data frames
dl = mget(paste0("df",1:5))

# List of plots
pl = lapply(names(dl), function(dat) {
  v = names(dl[[dat]])
  ggplot(dl[[dat]], aes_string(x=v[1], y=v[2])) + 
    geom_point(shape=2) + 
    ggtitle(paste(dat, "plot"))
})

png("4plots.png", 400, 400)
grid.arrange(grobs=pl[1:4], ncol=2)
dev.off()
png("5thPlot.png", 200, 200)
pl[[5]]
dev.off()

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


By : Mahesh
Date : March 29 2020, 07:55 AM
wish of those help I'm trying to overlay two contour plots in Julia using Plots with PyPlot backend. Is it possible, and, if so, how? , Solution
Use contour!:
code :
using Plots
pyplot()
a = rand(50,50)
b = rand(50,50)
contour(a,seriescolor=:blues)
contour!(b,seriescolor=:reds)

How to overlay plots in Julia with transparency (using Plots)


By : jagdeep
Date : March 29 2020, 07:55 AM
This might help you Turns out, that seriesalpha was the setting I needed. However it does not work when gr backend is used.

Erasing previous data/plots in Julia (Plots.jl, GR backend)


By : md yobar
Date : March 29 2020, 07:55 AM
I wish this help you Erasing previous data is not possible with Plots.jl. The previous plot can be erased by using plot or scatter commands instead of plot! and scatter!. Here are some examples how animations can be created using the @gif macro (http://docs.juliaplots.org/latest/animations/)
Create some dummy data:
code :
using Plots

t = range(0, 4π, length = 100)
r = range(1, 0, length = 100)

x = cos.(t) .* r
y = sin.(t) .* r
@gif for i in eachindex(x)
    scatter((x[i], y[i]), lims = (-1, 1), label = "")
end
@gif for i in eachindex(x)
    plot(x[1:i], y[1:i], lims = (-1, 1), label = "")
    scatter!((x[i], y[i]), color = 1, label = "")
end
@gif for i in eachindex(x)
    plot(x[1:i], y[1:i], alpha = max.((1:i) .+ 10 .- i, 0) / 10, lims = (-1, 1), label = "")
    scatter!((x[i], y[i]), color = 1, label = "")
end
Related Posts Related Posts :
  • How to determine if a dictionary has some key?
  • How can I add a new key value pair to an existing dictionary?
  • Suppress warning about conflict with existing identifier
  • How to iterate over two arrays in parallel
  • How to enable color globally for all Julia scripts?
  • How do I access the last element of an array?
  • Why are immutable structs default in Julia?
  • Efficiently convert Dict to NamedTuple in Julia
  • MethodError when dispatching on a parametric vector of vectors
  • How to build histogram in Julia
  • How can I enable debug output?
  • Read multiple variables (from stdin) in Julia with a single line of code
  • How can I remove a key from a dictionary?
  • Generalise heterogeneous tuple of variable-length MVector's to a variable number of MVector's
  • Is there a way to limit logging to only print every N times in Julia?
  • Is there a Julia function to do appropriate hostname resolution?
  • Functioning of permutedims in Julia unclear
  • Julia Flux error: SGD optimiser is undefined
  • In what way(s) can I benchmark a Julia function?
  • shadow
    Privacy Policy - Terms - Contact Us © 35dp-dentalpractice.co.uk