Skip to content
Advertisement

Tag: matplotlib

Linear regression plot on log scale in Python

I want to do linear regression to the data given by x and y. Everything seems to be fine when I use a linear plot, but when I want to plot it on a log scale the line does not look straight. I think I should divide the interval into finer grids rather than only six points. But I couldn’t

Adding arrows to mpf finance plots

I am trying to add an arrow on a given date and price to mpf plot. To do this i have the following code: But it is producing the following error: Could you please advise how can i resolve this. Answer If your ultimate goal is to add an arrow to the title of the question, you can add it

Generating Scatter Plot from a Matrix

I have a code that generates random matrices of 0’s and 1’s, and I’d like to convert these matrices into scatter plots, where the coordinate corresponds to the matrix row/column, and the color of the scatter point corresponds to the value (red if 0, blue if 1 for example). I’ve been able to do this with matplotlib, but my use-case

Closing figures from previous sessions

I am running a python code that produces some figures with Matplotlib and Pandas. After a few runs of the code, I am getting to following error: RuntimeWarning: More than 20 figures have been opened. Figures created through the pyplot interface (matplotlib.pyplot.figure) are retained until explicitly closed and may consume too much memory. (To control this warning, see the rcParam

Sorted X axis ticks in Matplotlib when using multiple datasets

I have several datasets that I want to plot. The x values are “categorical” strings, in the sense that they have no particularly meaning, but they are sortable (alphanumeric). Each dataset has some X values that are unique, and some that are in common. The desired output is a graph where the xXtick labels are in sorted order. Unfortunately I

Advertisement