Skip to main content

All Questions

Tagged with
0 votes
2 answers
171 views

How to change the color of a single line plot based on another variable

I want to plot a line using the following equation. y = x(1+0.25ε) Where, x = {0, 1, 2, ..., 200} ε = np.random.randn() And i want to change the color of the plot based on slop. I.e it should be blue ...
imtiaz ul Hassan's user avatar
0 votes
0 answers
106 views

Is there a more elegant way to apply complicated functions to meshgrid?

My goal is to plot the function $f(x,y) = 3^{\min\{x,2\}}t_0 y$ where $t_0$ is the smallest solution of $2t^x-3t-1=0$ (it's just a MWE; I didn't check the existence of the root(s). ) I did it. But in ...
Piko Mone's user avatar
1 vote
2 answers
1k views

How to detect if there is intersection using matplotlib?

I am using matplotlib to plot these two line graphs. However, only sometimes my graphs would have an intersection. How can I detect if my line graphs have an intersection? df = pd.read_csv("test....
Don99's user avatar
  • 229
1 vote
1 answer
399 views

Plotting epicycles by using matplotlib

Why does the following code not working? I want to display epicycles by using matplotlib like a following image import matplotlib.pyplot as plt import numpy as np from numpy import * import math ...
vito's user avatar
  • 147
0 votes
2 answers
6k views

Python plot 1D array

I would like to plot the difference between each individual point. I have one series y_test which is one-dimensional and contains continuous values. The index is kinda whacky (7618, 276, 7045, 6095, ...
Bigboss01's user avatar
  • 628
1 vote
2 answers
2k views

Show only certain tick labels in log plot

The code below produces plots like this one: I need to show only the tick labels in the y axis that are over the horizontal line. In this case, the labels [2,3,4,5] would need to be hidden. I've ...
Gabriel's user avatar
  • 42.6k
0 votes
1 answer
345 views

Projection of data onto principal component yields incorrect result

I'm attempting to project 2D data points onto the top principal component of the data's covariance matrix, but my projected points don't lie on the expected vector. Below is my code and output. I've ...
Munib Hasnain's user avatar
-1 votes
1 answer
71 views

How do I draw a time series that shows the amount of change in data?

For example, I have data such as: 18:00:00 0 18:00:01 -1 18:00:02 -1 18:00:03 -1 18:00:04 2 18:00:05 -3 18:00:06 1 18:00:07 2 18:00:08 3 18:00:09 4 18:00:10 5 ...
birdalugur's user avatar
0 votes
2 answers
2k views

how do i store pcolormesh plot as a numpy array - while preserving data shape?

I seem to have some problems storing a plot created using matplotlib.pcolormesh(). As far i know is pcolormesh convert an input data matrix using a colormap. The colormap outputs a RGB value for each ...
J.Down's user avatar
  • 775
0 votes
1 answer
2k views

3D pcolor/pclormesh plot in matplotlib

1. My attempt 2-d numpy array represent some value of an area, showing like this: http://i8.tietuku.com/90d045a6c2375474.png And I want to plot the value in the Z-axis. For example, ...
Han Zhengzu's user avatar
  • 3,852
8 votes
2 answers
32k views

plotting a 2D matrix in python, code and most useful visualization

I have a very large matrix(10x55678) in "numpy" matrix format. the rows of this matrix correspond to some "topics" and the columns correspond to words(unique words from a text corpus). Each entry i,j ...
Hossein's user avatar
  • 42.1k