Skip to content

Tag: matplotlib

Animating two circles Python

I have a text file, with the coordinates of two circles on it. I want to produce a live animation of both particles. For some reason the following code crashes The text file that the data is taken from has the columns of X1, Y1, X2 and Y2 where X1 represents the x coordinate of the 1st particle etc. If

Returning plt.show() on HTML with Python Flask

I’m using Python Flask to take input from a simple html file. The HTML asks the user to input a state and when they do that I would like for the output to be a plot. I have the following code that’s creating the Python Flask but when a user inputs a state, the plot outputs in my Jupyter Notebook

How to make just one marker as hollow in matplotlib plot?

I have the following code: I tried the above and got the following error- How do I resolve this ? or is there an alternative solution to the problem ( rather than splitting into multiple figures)? Answer If you read the documentation associated to plt.plot, if you will see that the only properties affecting m…

Images constructed from dataset rotated

I am not very experienced with python plotting. I want to work with YaleB_32x32 dataset (https://github.com/flatironinstitute/online_psp/blob/master/datasets/YaleB_32x32.mat). This is my code : This is the output. As you can see that images are rotated. Could someone please help me with where am I going wrong…

Superscripting a string in python

Hello I am trying to superscript a string for a plot. And the result i get is: The “-0,2*x” should be superscripted. What am I doing wrong? Thank you! Answer It IS making the – a superscript. To get the whole expression in there, you need to enclose the whole expression in curly braces. Sinc…