Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb5ec33f

Browse files
committed
added ridgeline plot
1 parent61827c3 commitb5ec33f

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

‎notebooks/violin.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,30 @@ fig.update_layout(
236236
fig.show()
237237
```
238238

239+
#### Ridgeline plot
240+
241+
A ridgeline plot ([previously known as Joy Plot](https://serialmentor.com/blog/2017/9/15/goodbye-joyplots)) shows the distribution of a numerical value for several groups. They can be used for visualizing changes in distributions over time or space.
242+
243+
```python
244+
import plotly.graph_objectsas go
245+
from plotly.colorsimport n_colors
246+
import numpyas np
247+
248+
# 12 sets of normal distributed random data, with increasing mean and standard deviation
249+
data= (np.linspace(1,2,12)[:, np.newaxis]* np.random.randn(12,200)+
250+
(np.arange(12)+2* np.random.random(12))[:, np.newaxis])
251+
252+
colors= n_colors('rgb(5, 200, 200)','rgb(200, 10, 10)',12,colortype='rgb')
253+
254+
fig= go.Figure()
255+
for data_line, colorinzip(data, colors):
256+
fig.add_trace(go.Violin(x=data_line,line_color=color))
257+
258+
fig.update_traces(orientation='h',side='positive',width=3,points=False)
259+
fig.update_layout(xaxis_showgrid=False,xaxis_zeroline=False)
260+
fig.show()
261+
```
262+
239263
####Reference
240264
Seehttps://plot.ly/python/reference/#violin for more information and chart attribute options!
241265

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp