plotly / plotly/plotly.py

Since upgrading plotly.py to 5.15.0 subplots with 2 columns, the yaxis2 title_text is showing on the left next to yaxis

オープン
#4,283 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

bug P3 regression
主要言語
Python
スター
18.8k
フォーク
2.8k
平均マージ
16時間 26分
マージ済み PR(30日)
21

説明

After upgrading plotly.py to 5.15.0
subplots with two columns created by cufflinks subplot command have all the yaxis labels on the left, not next to each subplot.
The head of the file created has "https://cdn.plot.ly/plotly-2.24.1.min.js" if I edit this file to use js "https://cdn.plot.ly/plotly-2.11.1.min.js" the plots are OK as expected.

I am not sure if this is a plotly js issue or a cufflinks issue
When creating similar subplots without cufflinks they look OK.

Code to make failed chart

from plotly.subplots import make_subplots
import plotly.graph_objects as go
import plotly.io as pio
pio.templates.default = 'plotly_white'
import setuptools
import pandas as pd
import cufflinks as cf
cf.set_config_file(offline=True)
cf.set_config_file(theme='white')

data = {
"yaxis1": [420, 380, 390],
"yaxis2": [50, 40, 45],
"yaxis3": [30, 50, 70],
"yaxis4": [222, 333, 444]
}

#load data into a DataFrame object:
df = pd.DataFrame(data)
print(df)

fig=cf.subplots([df.loc[:,'yaxis1'].figure(kind='scatter',name='YAXIS1'),
df.loc[:,'yaxis2'].figure(kind='scatter',name='YAXIS2'),
df.loc[:,'yaxis3'].figure(kind='scatter',name='YAXIS3'),
df.loc[:,'yaxis4'].figure(kind='scatter',name='YAXIS4')],
shape=(2,2),shared_xaxes=True,shared_yaxes=True,subplot_titles=("Plot 1", "Plot 2", "Plot 3", "Plot 4"))
fig['layout']['hoverlabel'] = dict(namelength = -1)
fig['layout']['hovermode']='x'
fig['layout']['height']=600
fig['layout']['width']=800
fig['layout']['modebar']=({'add': ['v1hovermode', 'toggleSpikeLines']})
fig['layout']['title']="Side By Side Subplots"
fig['layout']['xaxis'].update({'showticklabels': True})
fig['layout']['xaxis2'].update({'showticklabels': True})
fig['layout']['xaxis3'].update({'showticklabels': True})
fig['layout']['xaxis4'].update({'showticklabels': True})
fig['layout']['yaxis'].update({'title_text':'yaxis1'})
fig['layout']['yaxis2'].update({'title_text':'yaxis2'})
fig['layout']['yaxis3'].update({'title_text':'yaxis3'})
fig['layout']['yaxis4'].update({'title_text':'yaxis4'})
pio.write_html(fig, file='test_subplot_cf.html', auto_open=True, include_plotlyjs='cdn')

FAILS:

<script type="text/javascript">window.PlotlyConfig = {MathJaxConfig: 'local'};</script> <script charset="utf-8" src="https://cdn.plot.ly/plotly-2.24.1.min.js"></script>

Change the JS file and it comes good, no other changes needed.
WORKS:

<script type="text/javascript">window.PlotlyConfig = {MathJaxConfig: 'local'};</script> <script charset="utf-8" src="https://cdn.plot.ly/plotly-2.11.1.min.js"></script>

Code without cufflinks that works OK

from plotly.subplots import make_subplots
import plotly.graph_objects as go
import plotly.io as pio

fig = make_subplots(rows=2, cols=2,subplot_titles=("Plot 1", "Plot 2", "Plot 3", "Plot 4"))

fig.add_trace(
go.Scatter(x=[1, 2, 3], y=[4, 5, 6]),
row=1, col=1
)
fig.add_trace(
go.Scatter(x=[11, 12, 13], y=[4, 5, 6]),
row=2, col=1
)

fig.add_trace(
go.Scatter(x=[20, 30, 40], y=[50, 60, 70]),
row=1, col=2
)
fig.add_trace(
go.Scatter(x=[21, 31, 41], y=[50, 60, 70]),
row=2, col=2
)

fig.update_layout(modebar_add=["v1hovermode", "toggleSpikeLines"],height=600, width=800, title_text="Side By Side Subplots",yaxis=dict(title_text='yaxis1'),yaxis2=dict(title_text='yaxis2'),yaxis3=dict(title_text='yaxis3'),yaxis4=dict(title_text='yaxis4'))
pio.write_html(fig, file='test_subplot.html', auto_open=True, include_plotlyjs='cdn')

H:\aaPrograms>pip list
Package Version


affinity 0.1.0
aiosignal 1.3.1
altgraph 0.17.3
ansiwrap 0.8.4
anyio 3.6.2
appdirs 1.4.4
argon2-cffi 21.3.0
argon2-cffi-bindings 21.2.0
asttokens 2.2.1
async-generator 1.10
attrs 22.1.0
Babel 2.11.0
backcall 0.2.0
beautifulsoup4 4.11.1
black 22.10.0
bleach 5.0.1
Brotli 1.0.9
bz2file 0.98
cachelib 0.9.0
certifi 2022.9.24
cffi 1.15.1
chardet 5.0.0
charset-normalizer 2.1.1
chart-studio 1.1.0
click 8.1.3
colorama 0.4.6
colorlover 0.3.0
comm 0.1.3
contourpy 1.0.6
cryptography 38.0.3
cufflinks 0.17.3
cycler 0.11.0
Cython 0.29.33
dash 2.7.0
dash-core-components 2.0.0
dash-html-components 2.0.0
dash-table 5.0.0
debugpy 1.6.7
decorator 5.1.1
defusedxml 0.7.1
descartes 1.1.0
distlib 0.3.6
entrypoints 0.4
executing 1.2.0
fastjsonschema 2.16.2
file-read-backwards 2.0.0
filelock 3.9.0
filetype 1.2.0
Flask 2.2.2
Flask-Compress 1.13
Flask-Session 0.4.0
fonttools 4.38.0
frozenlist 1.3.3
future 0.18.2
grpcio 1.51.1
html2image 2.0.3
idna 3.4
imgkit 1.2.3
importlib 1.0.4
importlib-metadata 5.0.0
importlib-resources 5.10.0
inflate64 0.3.1
ipykernel 6.22.0
ipython 8.13.1
ipython-genutils 0.2.0
ipywidgets 8.0.6
itsdangerous 2.1.2
jedi 0.18.2
Jinja2 3.1.2
joblib 1.2.0
json5 0.9.10
JsonForm 0.0.2
jsonschema 4.17.0
JsonSir 0.0.2
jupyter 1.0.0
jupyter_client 8.2.0
jupyter-console 6.4.4
jupyter_core 5.3.0
jupyter-server 1.23.2
jupyterlab 3.5.0
jupyterlab-pygments 0.2.2
jupyterlab_server 2.16.3
jupyterlab-widgets 3.0.7
kaleido 0.2.1
kiwisolver 1.4.4
lxml 4.9.1
MarkupSafe 2.1.1
matplotlib 3.6.2
matplotlib-inline 0.1.6
microsoftgraph-python 1.1.4
mistune 2.0.4
mizani 0.8.1
msal 1.20.0
msgpack 1.0.4
multivolumefile 0.2.3
mypy-extensions 0.4.3
nbclassic 0.4.8
nbclient 0.7.0
nbconvert 7.2.5
nbformat 5.7.0
nest-asyncio 1.5.6
notebook 6.5.2
notebook_shim 0.2.2
numpy 1.24.3
O365 2.0.21
oauthlib 3.2.2
Office365-REST-Python-Client 2.3.15
OnedriveCMD 0.1.8.1
onedrivesdk 2.0.1
packaging 23.1
palettable 3.3.0
pandas 2.0.1
pandas-read-xml 0.3.1
pandocfilters 1.5.0
papermill 2.4.0
parquet 1.3.1
parso 0.8.3
pathspec 0.10.2
patsy 0.5.3
pefile 2022.5.30
pickleshare 0.7.5
Pillow 9.3.0
pip 23.2
platformdirs 3.5.0
plotly 5.15.0
plotnine 0.10.1
ply 3.11
progress 1.6
prometheus-client 0.15.0
prompt-toolkit 3.0.38
protobuf 4.21.12
psutil 5.9.5
pure-eval 0.2.2
py7zr 0.20.2
pyarrow 10.0.0
pybcj 1.0.1
pycparser 2.21
pycryptodomex 3.15.0
Pygments 2.15.1
pyinstaller 5.6.2
pyinstaller-hooks-contrib 2022.13
PyJWT 2.6.0
pynsist 2.8
pyparsing 3.0.9
PyPDF2 2.11.1
pyppmd 1.0.0
PyQt5 5.15.7
PyQt5-Qt5 5.15.2
PyQt5-sip 12.11.0
pyrsistent 0.19.2
python-dateutil 2.8.2
python-docx 0.8.11
Python-EasyConfig 0.1.7
python-magic 0.4.27
python-snappy 0.6.1
pytz 2023.3
pytz-deprecation-shim 0.1.0.post0
pywin32 306
pywin32-ctypes 0.2.0
pywinpty 2.0.9
PyYAML 6.0
pyzmq 25.0.2
pyzstd 0.15.3
qtconsole 5.4.0
QtPy 2.3.0
ray 2.2.0
regex 2022.10.31
requests 2.28.1
requests_download 0.1.2
requests-oauthlib 1.3.1
Resource 0.2.1
retrying 1.3.3
scipy 1.9.3
seaborn 0.12.1
Send2Trash 1.8.0
setuptools 67.7.2
sharepoint 0.4.2
six 1.16.0
sklearn 0.0.post5
sniffio 1.3.0
soupsieve 2.3.2.post1
stack-data 0.6.2
statsmodels 0.13.5
stringcase 1.2.0
sv-ttk 2.4
tabulate 0.9.0
tenacity 8.2.2
terminado 0.17.0
testpath 0.6.0
texttable 1.6.4
textwrap3 0.9.2
threadsafe-tkinter 1.0.2
thriftpy 0.3.9
thriftpy2 0.4.15
tinycss2 1.2.1
tkfilebrowser 2.3.2
toml 0.10.2
tomli 2.0.1
tornado 6.3.1
tqdm 4.64.1
traitlets 5.9.0
ttkthemes 3.2.2
typed-ast 1.5.4
typing_extensions 4.4.0
tzdata 2023.3
tzlocal 4.2
urllib3 1.26.12
virtualenv 20.17.1
wcwidth 0.2.6
webencodings 0.5.1
websocket-client 1.4.2
Werkzeug 2.2.2
wheel 0.38.4
widgetsnbextension 4.0.7
wkhtmltopdf 0.2
xmltodict 0.13.0
yarg 0.1.9
zipfile36 0.1.3
zipp 3.10.0

image

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

提供されている cufflinks subplot reproducer から始め、生成された HTML を Plotly.js 2.24.1 と 2.11.1 で比較し、その後、動作している make_subplots の例と比較してください。回帰が cufflinks によって生成された layout にあるのか、JavaScript のレンダリングにあるのかを特定し、現在のバージョンで yaxis2 から yaxis4 のタイトルがそれぞれの subplot の横に表示されることを確認してください。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, pandas, python
領域
data-visualization
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。