I am attempting to use matplotlib’s LineCollection in PyPlot to multiple sets of discontinuous lines in a loop. I started writing my code after reading this: http://julia-programming-language.2336112.n4.nabble.com/PyPlot-LineCollection-help-needed-td42361.html
Here is what I have:
using PyPlot lines = [[[(10,30), (20,70)] [(20,40),(30, 100)]], [[(1,5), (2,7)] [(2,4),(3, 1)]]] fig = figure() ax = gca() for i=1:2 ls = matplotlib.collections.LineCollection(lines[i]) ax.clear() ax.add_collection(ls) axis("image") sleep(3) end
This plots 2 lines first on a larger scale then 2 different lines in a smaller domain.
axis("image") is what displays the plot, but also sets the limits on the x and y-axis. I would like to set the limits of the x and y axis to the global min and max of all of the lines in
lines not just for a single set of lines,
lines[i] for ever iteration of the loop. Assuming I already have those values are
ylims_tuple, I should be able to use
axis(xlim = (xlims_tuple), ylims=(ylims_tuple) to set them. Although if I do not use
axis("image") (again I dont want to overide the newly set xlim and ylim) to display the the plot, I cannot find any other way to display it.
show() does not appear to work. How can I display the plots?