Skip to content

Tag: matplotlib

Format y axis as percent

I have an existing plot that was created with pandas like this: The y axis is format as float and I want to change the y axis to percentages. All of the solutions I found use ax.xyz syntax and I can only place code below the line above that creates the plot (I cannot add ax=ax to the line above.)

Python hide ticks but show tick labels

I can remove the ticks with but this removes the labels as well. Any way I can plot the tick labels but not the ticks and the spine Answer You can set the tick length to 0 using tick_params (http://matplotlib.org/api/axes_api.html#matplotlib.axes.Axes.tick_params):

Plotting in a non-blocking way with Matplotlib

I am having problems trying to make matplotlib plot a function without blocking execution. I have tried using show(block=False) as some people suggest, but all I get is a frozen window. If I simply call show(), the result is plotted properly but execution is blocked until the window is closed. From other thre…

Matplotlib error: libfreetype.6.dylib

I’m trying to run the following python script (I’m using Vim): When I do, I get the following: I tried reinstalling brew, reinstalling freetype, matplotlib, and numpy in brew, and I uninstalled MacPorts with no change in the error. Suggestions? EDIT: After uninstalling MacPorts and then doing anot…

Python: Matplotlib avoid plotting gaps

I am currently generating the plot below: with this code: where intra.to_pydatetime() is a: <bound method DatetimeIndex.to_pydatetime of <class ‘pandas.tseries.index.DatetimeIndex’> [2011-01-03 09:35:00, …, 2011-01-07 16:00:00] Length: 390, Freq: None, Timezone: None> So the date…

How do I bin and categorize numbers in Python?

I’m not sure if binning is the correct term, but I want to implement the following for a project I am working on: I have an array or maybe a dict describing boundaries and/or regions, for example: The areas are indexed from 0 to 100 (for example). I want to classify each area into a color (that is less …