Mike Kharkov Mike Kharkov - 1 month ago 20
Python Question

Matplotlib. The scroll bar doesn't exist?

I have some Python and

matplotlib
library questions.

enter image description here

First:

I want to remove the text in the bottom left corner (axex: x,y and the coords).

Second:

Can I set a scroll bar on the chart?

I want a fixed width chart where a horizontal scroll bar appears if the data is too large to fit in the fixed width.

Answer

You can add a scroll bar with

from matplotlib.widgets import Slider
import matplotlib.pyplot as plt

fig, ax = plt.subplots(figsize=(16, 12))
axframe = plt.axes([0.125, 0.1, 0.775, 0.03])
sframe = Slider(axframe, 'Point-Nr', 1, 200, valinit=1, valfmt='Nr.%d')


def update(val):
    ax.plot(int(sframe.val), int(sframe.val)*2, 'o-')

sframe.on_changed(update)
plt.show()

Regards Dr. Cobra