I want to plot data where x axis is long. If I plot the whole x axis then the plot shrinks and it is almost unreadable. I\'ve found this answer on SO which points to followi
Have you considered using matplotlib slider widgets?
Here is a little code just to show as example
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.widgets import Slider
fig, ax = plt.subplots()
plt.subplots_adjust(bottom=0.25)
t = np.arange(0.0, 100.0, 0.1)
s = np.sin(2*np.pi*t)
l, = plt.plot(t,s)
plt.axis([0, 10, -1, 1])
axcolor = 'lightgoldenrodyellow'
axpos = plt.axes([0.2, 0.1, 0.65, 0.03], axisbg=axcolor)
spos = Slider(axpos, 'Pos', 0.1, 90.0)
def update(val):
pos = spos.val
ax.axis([pos,pos+10,-1,1])
fig.canvas.draw_idle()
spos.on_changed(update)
plt.show()
In R
this answer could help you. It will save the plot as a separate png, but you can change the format type with a different command. The relevant code from that answer is reproduced:
png("wide.png", width = 1e5, height = 500)
plot((sin(1:10000/100)+rnorm(10000)/5),type='l')
dev.off()
#bmp("wide.bmp", width = 1e5, height = 500)
#plot((sin(1:10000/100)+rnorm(10000)/5),type='l')
#dev.off()
#note that the png has a size of 396 KB, while the bmp has 48,830 KB.