Pie charts in plotly [closed] - python

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
I couldn't find any examples or documentation for/about pie charts in plotly. Anyone knows if they are simply not implemented yet?
I actually never ever had a use case for them until today.

That's right, they aren't implemented yet. The polar wedge charts are close, but each wedge has to be the same width: https://plot.ly/python/polar-chart/#Polar-Area-Chart
In the meantime, that type of categorical data can sometimes be visualized with stacked or grouped bar charts: https://plot.ly/python/bar-charts/#Grouped-Bar-Chart

A pie chart implementation for Python is already available at Plot.ly:
https://plot.ly/python/pie-charts/

Related

What toolkit in Python can achieve the effect as shown in the figure [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 1 year ago.
Improve this question
I'd like to draw a three-dimensional trajectory that can show the attitude of the plane as shown in the figure. What toolkit in Python I should learn?
What you are looking for is 3D Line plots of Matplotlib.
To help you get started, you can refer to this Blog: An easy introduction to 3D plotting with Matplotlib
The official Tutorial of matplotlib 3D Plots can be found here: Matplotlib 3D Tutorial - Lines
If you want to explore more, a very good resource to different types of Graph Plots along with code examples can be found here: Python Graph Gallery
the standard plotting library in python (pretty much) is Matplotlib. It contains a 3D API called mplot3d.
For an example, see here: https://matplotlib.org/stable/gallery/mplot3d/scatter3d.html
The example you are showing does look a lot like it was created with Matplotlib. Other options include seaborn and bokeh. Your choice what to use, really.

Best way to perform plotting with matplotlib to achieve OHLC like plots? [closed]

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

Cluster label plotting [closed]

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)

How can I visualize a 3D volume with Python? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 1 year ago.
Improve this question
Similar to how there's vol3d for Matlab, how can I visualize a 3D-Array in Python? I'm currently working with Matplotlib but I'll take whatever works.
Mayavi has some good API for 3D plotting in python
I strongly recommend K3D:
K3D lets you create 3D plots backed by WebGL with high-level API
(surfaces, isosurfaces, voxels, mesh, cloud points, vtk objects,
volume renderer, colormaps, etc). The primary aim of K3D-jupyter is to
be easy for use as stand alone package like matplotlib, but also to
allow interoperation with existing libraries as VTK.
It works best in Jupyter Notebook.
You are probably looking for mplot3d plot_surface, which is part of matplotlib. Examples are provided in the link.

Natural combination between Python and TeX [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
As a graduate, I often plot various kind of figures and have found many plotting software.
I appreciate the high quality drawings in TeX, using tools like Asymptote and Tikz. As a poor programmer, I also need the flexibility brought by Python when I need do some complex calculations during plotting. The combination from both side, which I deeply believe, will be a perfect choice.
So, is there any chance for me to find some software like this, with both Simple and Beatiful in mind.
There are several python libraries which excel at various types of graphics such as MayaVi.
Here is an example of simple TeX integration with matplotlib in python (not showing all the math stuff, but just the plotting code:
figure(2)
plot(x,Ni[:,1], 'b.', x, y, 'r.', x, z, 'g.', markersize=10)
xlabel('nm')
ylabel('Sulfur normalized intensity')
legend(['Ni/S', r'exp profile $\tau$ = 200 nm', r'exp profile $\tau$ = 98 nm'], loc='best', numpoints=1)
pylab.subplots_adjust(bottom=0.15, left=0.15)
show()
which produces:
Notice the tau is actually just a snippet of TeX embedded into the image. Most of the matplotlib commands allow this so you can draw equations into your image or whatever you want to do.

Categories