Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exported chart is shrunk in 0.4.5 #42

Open
actionbrk opened this issue Apr 22, 2021 · 5 comments
Open

Exported chart is shrunk in 0.4.5 #42

actionbrk opened this issue Apr 22, 2021 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@actionbrk
Copy link

actionbrk commented Apr 22, 2021

🐛 Bug Report

Exported chart looks different between 0.4.4 and 0.4.5. It looks shrunk in 0.4.5.

🔬 How To Reproduce

Steps to reproduce the behavior:

  1. Install datawrapper v0.4.4.
  2. Execute code sample and see exported chart.
  3. Install update to v0.4.5 (it only updates the datawrapper package).
  4. Execute code sample again and see exported chart.

Code sample

dw = Datawrapper(access_token=token)
df = pandas.DataFrame(
    [("01/01/2020", 2), ("01/02/2020", 4)], columns=["date", "messages"]
)
chart = dw.create_chart(title="Shrunk", chart_type="column-chart", data=df)
dw.export_chart(chart_id, filepath=f"{chart["id"]}.png")

Environment

  • OS: Windows 10
  • Python 3.8.3

Screenshots

unshrunk
shrunk

📈 Expected behavior

Exported chart should not look shrunk.

📎 Additional context

@actionbrk actionbrk added the bug Something isn't working label Apr 22, 2021
@github-actions
Copy link

Hello @actionbrk, thank you for your interest in our work!

If this is a bug report, please provide screenshots and minimum viable code to reproduce your issue, otherwise we can not help you.

@chekos
Copy link
Owner

chekos commented Apr 22, 2021

Hi @actionbrk , would you mind sharing both versions of the chart? Shrunk and non-shrunk?

I just tried recreating it and I get the same chart for both 0.4.4 and 0.4.5

version-0 4 5
version-0 4 4

@chekos chekos self-assigned this Apr 23, 2021
@actionbrk
Copy link
Author

Hi @chekos,

I recreated a new venv (still in Python 3.8.3) and pip installed datawrapper (v0.4.4), pandas and python-dotenv. I ran the same code. As with my old venv, the chart looks nice in 0.4.4 :
unshrunk

Then I updated datawrapper with pip install -U datawrapper. Not much new packages were installed :

Successfully installed commonmark-0.9.1 datawrapper-0.4.5 rich-9.13.0 shellingham-1.4.0 typer-0.3.2 typing-extensions-3.7.4.3

I ran the code again and got a shrunk chart :
shrunk

I first thought I had a problem with dependencies. I pip uninstall datawrapper and pip install datawrapper==0.4.4 and ran the code again to make sure the new dependencies coming along with 0.4.5 are not the problem ; but going back from 0.4.5 to 0.4.4 fixes it.

Here are the installed packages I have (pip freeze) :

backcall==0.2.0
certifi==2020.12.5
chardet==4.0.0
click==7.1.2
colorama==0.4.4
commonmark==0.9.1
datawrapper==0.4.5
decorator==5.0.7
idna==2.10
ipython==7.22.0
ipython-genutils==0.2.0
jedi==0.18.0
numpy==1.20.2
pandas==1.2.4
parso==0.8.2
pickleshare==0.7.5
prompt-toolkit==3.0.18
Pygments==2.8.1
python-dateutil==2.8.1
python-dotenv==0.17.0
pytz==2021.1
requests==2.25.1
rich==9.13.0
shellingham==1.4.0
six==1.15.0
traitlets==5.0.5
typer==0.3.2
typing-extensions==3.7.4.3
urllib3==1.26.4
wcwidth==0.2.5

Maybe the Python version has something to do with it? I think I will try to do the same with Python 3.9.

@actionbrk
Copy link
Author

I created a new venv with Python 3.9.4. I went through the same steps and I ended up with the same problem (and same dependency list).

@chekos
Copy link
Owner

chekos commented May 17, 2021

Sorry for the delay in response! i'm taking a look at this today. In datawrapper 0.4.5 we changed the default width to 100 (and the unit is still defaulted to "px") whereas before it was set to 600. That was a mistake on our part! Thanks for catching it @actionbrk

This will be fixed in 0.4.6 but in the mean time you can just dw.export_chart(chart_info['id'], title = "cool chart", width = 600) to restore previous behavior (or change it to whatever works for you!)

Again, thanks for catching this AND letting me know, I hadn't heard from other users but this is not the behavior I want by default 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants