Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
The library mplfinance offers a good possibility to perform OHLC plotting with Python/Matplotlib. Nevertheless I want to / have to build a small application that does a kind of OHLC plotting by itself.
I am wondering how I should perform the (huge) amount of vertical and horizontal bars by myself.
Is it the best to do a plt.plot() for all the data I have or is there a more performant way to do this using matplotlib?
Snippet of mplfinance output
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
I have cluster labels in one columns and one more column to make comparison or analyze the clusters.
import pandas as pd
parties_and_cluesters = pd.DataFrame({'Parties':['A','B','C','C','A','No Party','B','A'],
'Clusters':['Cluster 2','Cluster 1','Cluster 4','Cluster 4','Cluster 3','Cluster 0','Cluster 3','Cluster 2',]
})
What is the best way to see the outcome? I thought plotting bar-plot but didn't sound good to me. I want to see if clusters reasonable.
Question not clear. If wanted to visualize and feel nice try seaborn count plot
import seaborn as sns
ax = sns.countplot(x="Clusters", data=parties_and_cluesters)
Following your comments
parties_and_cluesters.groupby('Clusters')['Parties'].value_counts().unstack().plot.bar()
In addition to above answer, you may want to display it as stacked. And as I saw from the chat, you can use legend as a seperate part of your plot.
plt.figure(figsize=(20,10))
parties_and_cluesters.groupby('Clusters')["Parties"].value_counts().unstack().plot.bar(stacked=True)
plt.legend(bbox_to_anchor=(1.05, 1), loc='upper left')
plt.gcf().set_size_inches(10, 5)
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
How would I make an interactive plot like the one displayed here? I'd like to show an image with x and y slices of the image taken at a point that can be adjusted by clicking on the image.
I know this one was made in Chaco, but since Chaco isn't compatible with python3, just matplotlib or bokeh would be preferable.
Using tacaswells suggestion, I found that the cross_section_2d in bubblegum was just what I was looking for.
First I installed bubblegum from github https://github.com/Nikea/bubblegum.git
Then the following sets up a cross_section image
import matplotlib.pyplot as plt
import numpy as np
from bubblegum.backend.mpl.cross_section_2d import CrossSection
fig= plt.figure()
cs= CrossSection(fig)
img= np.random.rand(100,100)
cs.update_image(img)
plt.show()
Thanks!
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I would like to know if someone has an easy program to plot Planetary Boundary Layer height on a map (2D in lat/lon) in fortran 90 or python (or NCL).
I am using a program in F.90 but it is not working so I would like to compare with a second program.
Thank you
Here's a Python example with matplotlib and netCDF4 modules:
import matplotlib.pyplot as plt
from netCDF4 import Dataset
nc = Dataset('mydatafile.nc','r')
lon = nc.variables['lon'][:]
lat = nc.variables['lat'][:]
pblh = nc.variables['pblh'][:]
nc.close()
plt.contourf(lon,lat,pblh)
plt.colorbar()
plt.savefig('pblh.png')
ptl.clf()
You may need to edit this example to match your data, e.g. filename, variable names etc.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed last year.
Improve this question
I have used pydot and networkx to build and show my graph. I have two questions:
How can I differentiate between the nodes with similar names?
For instance, there are two nodes with different values, but I want to show both of them with 'node_x' in my graph.
How can I draw a rectangle around a set of nodes in my graph?