hupili / python-for-data-and-media-communication-gitbook

An open source book on Python tailed for communication students with zero background
118 stars 62 forks source link

The words were blocked in the pyecharts #130

Open Graceyit opened 5 years ago

Graceyit commented 5 years ago

Troubleshooting

Describe your environment

Describe your question

The words at the bottom were blocked. 2018-12-05 4 19 59

The minimum code (snippet) to reproduce the issue

from pyecharts import Bar
tf=df.groupby(['title'])['favorite'].mean().reset_index().sort_values("favorite",ascending=False)[:15]
tt=df.groupby(['title'])['thumb'].mean().reset_index().sort_values("thumb",ascending=False)[:15]
attr=tf.title
v1=tf.favorite
v2=tt.thumb
bar=Bar('article by favorite and thumb')
bar.add('by favorite',attr,v1,xaxis_interval=0, xaxis_rotate=30,mark_line=['average'])
bar.add('by thumb',attr,v2,xaxis_interval=0, xaxis_rotate=30,mark_line=['average'])
bar

Describe the efforts you have spent on this issue

What is the closest answer you can find?

grid: { x: 100,y2: 200 }

hupili commented 5 years ago

Does the following example solve your issue?

https://nbviewer.jupyter.org/github/hupili/python-for-data-and-media-communication/blob/master/pyecharts-examples/pyecharts-resize.ipynb?xfffcachffffxsdfsdffffxffe#Change-graph-size-and-display-in-NBViewer

ChicoXYC commented 5 years ago

@Graceyit has your problem solved?

hupili commented 5 years ago

The code is not reproducible. @ChicoXYC , please try to get the data that produces this case. Without content loaded in df or tf, the chart can not be reproduced. After that, please check if my link solves the issue. Let me know if that still doesn't work

Graceyit commented 5 years ago

I am really sorry that I reply you so late. And I have tried again the code you gave me but I do not know if I am right.It seems that the problem doesn't be solve.

2018-12-29 3 33 12 2018-12-29 3 33 24
hupili commented 5 years ago

@Graceyit can you provide the following information?

hupili commented 5 years ago

It also works if you can link to your project repo where we can find this data file.

Graceyit commented 5 years ago

OK pili, here is the code

from pyecharts import Bar
tf=df.groupby(['title'])['favorite'].mean().reset_index().sort_values("favorite",ascending=False)[:15]
tt=df.groupby(['title'])['thumb'].mean().reset_index().sort_values("thumb",ascending=False)[:15]
attr=tf.title
v1=tf.favorite
v2=tt.thumb
bar=Bar('article by favorite and thumb')
bar.add('by favorite',attr,v1,xaxis_interval=0, xaxis_rotate=30,mark_line=['average'])
bar.add('by thumb',attr,v2,xaxis_interval=0, xaxis_rotate=30,mark_line=['average'])
bar

but I didn't put this code in the final project https://github.com/Graceyit/BigData-Final-Project-woshipm.com/blob/master/Data%20analysis%20P1/Data%20Analysis%20P1.ipynb

And this link is the data file. https://github.com/Graceyit/BigData-Final-Project-woshipm.com/blob/master/Data%20analysis%20P2/haha.csv

ChicoXYC commented 5 years ago

After I tried some methods, Still cannot solve the problem.

I think its the problem of pyecharts, they set the fixed size of text label margin of the charts. And give no option/parameters to change by users. https://nbviewer.jupyter.org/github/ChicoXYC/exercise/blob/master/py-echarts/pyecharts-text%20label.ipynb