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

ArcPlot figure too small and with lots of space #598

Open
kwbln opened this issue Mar 27, 2020 · 5 comments
Open

ArcPlot figure too small and with lots of space #598

kwbln opened this issue Mar 27, 2020 · 5 comments

Comments

@kwbln
Copy link

kwbln commented Mar 27, 2020

  • nxviz version: 0.6.2
  • Python version: 3.6.10
  • Jupyter: 1.0.0
  • Operating System: Windows 10 Home

Description

Hi! I'm a bit unsatisfied with the figure size in Jupyter Notebook and the white space the plot produce.
I have tried to change the figure size but the result is not very nice.

What I Did

# 1 - without figure size setting
a = ArcPlot(K, 
            edge_width='weight', edge_color='weight',
           node_size='betweenness')
a.draw()
plt.show()

# 2 - with figure size setting
a = ArcPlot(K, figsize=(30,30), 
            edge_width='weight', edge_color='weight',
           node_size='betweenness')
a.draw()
plt.show()

Result 1:
grafik

Result2:
grafik

@ericmjl
Copy link
Owner

ericmjl commented Mar 28, 2020

I'm not sure at first glance whether this will work, but what does the output look like when you do each of:

  • plt.tight_layout()
  • plt. autoscale()

?

I have a hunch that one of them should work out.

@kwbln
Copy link
Author

kwbln commented Mar 28, 2020

Hi Eric!

Thanks for the hint - the combination of both helps, but it's still not the optimum I think.

If I set a 'figure.facecolor', it looks like the plot/image itself needs too much space:
grafik

It would be nice if there is an auto-scaling depending on the nodes and edges.

Best regards,
Kerstin

@ericmjl
Copy link
Owner

ericmjl commented Mar 29, 2020

Hi Kerstin, indeed you've hit an interesting problem here. I'm not sure how best to solve this at the moment. That said, I think I have a few hypotheses on how to fix it. Can you provide source code that generates dummy example graph like your own that I can test with?

@kwbln
Copy link
Author

kwbln commented Mar 29, 2020

I will upload my "Kangaroo Network" to Github and give you access. I'm following along your DataCamp course ;)

@ericmjl
Copy link
Owner

ericmjl commented Mar 30, 2020

@kwbln I went into the source code and modified the implementation of draw(). For the time being, I suspect that just using plt.tight_layout() and plt. autoscale() is the best solution available (even though it may still result in some excessive whitespace).

This coming weekend, I'll see how pushing the two lines of code into the ArcPlot changes things (or if it even does change things).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants