차밍이
[Python] Plotly 축 반전, x축 y축 반전 뒤집기 본문
반응형
Y축 반전 뒤집기
기본 수식 작성
import plotly.graph_objects as go
import numpy as np
x = np.arange(-5, 6)
y = x**3
fig = go.Figure(data=go.Scatter(x=x, y=y))
fig.show()
축 반전
fig.update_layout(
yaxis = dict(autorange='reversed'),
)
update_layout
에서 자동 범위 설정을 reversed
로 설정하면 반전이 수행됩니다.
x 축은 xaxis
로 설정해서 하면 동일하게 적용할 수 있습니다.
전체 소스 코드
import plotly.graph_objects as go
import numpy as np
x = np.arange(-5, 6)
y = x**3
fig = go.Figure(data=go.Scatter(x=x, y=y))
fig.update_layout(
yaxis = dict(autorange='reversed'),
)
fig.show()
반응형
'파이썬 > 데이터 시각화' 카테고리의 다른 글
[Plotly] express와 graph_objects의 차이 / px와 go 차이 (0) | 2023.01.20 |
---|---|
[Python] Plotly : subplot 만들기의 모든것 - subtitle, type 설정 포함 (0) | 2022.07.24 |
[Python] Plotly legend(범례) 의 모든 것 - 순서, 위치, 폰트 등 (0) | 2022.07.23 |
[Python] Plotly 자주 사용하는 Layout 설정 - title, 축 label, font, subtitle, position 등 (4) | 2022.06.19 |
[Python] Plotly 그래프 사용법 - Line Plot (0) | 2021.01.28 |
[Python] Plotly 그래프 사용법 - Scatter Plot (0) | 2021.01.27 |
[Python] cufflinks, QunatFig, Plotly 주식 그래프 예쁘고 편하게 그리기 - 파이썬 주식투자(7) (6) | 2021.01.23 |
[Python] Plotly를 활용한 주식 차트 그리기 / 캔들스틱 그래프 그리기 / CandleStick Chart - 파이썬 주식투자(6) (2) | 2021.01.22 |
관련된 글 보기
Comments