question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Rotate axis in plot

See original GitHub issue

Hi @marcomusy

I’ve a plot like the following

image

import networkx as nx
from collections import OrderedDict
from vedo.pyplot import DirectedGraph
from vedo import *


G = nx.gnm_random_graph(n=5, m=10)
nxpos = nx.spring_layout(G, dim=3, seed=1)

nxpts = [nxpos[pt] for pt in sorted(nxpos)]
nx_lines = [(nxpts[i], nxpts[j]) for i, j in G.edges()]
pts = Points(nxpts, r=10).lighting('off')
edg = Lines(nx_lines).lw(5)

weights = [1, .30, .10, .79, .70, .60, .75, .78, .65, .90]
color = colorMap(weights, name="viridis")
edge_w = OrderedDict(zip(G.edges, weights))
nx.set_edge_attributes(G, edge_w, 'weight')

edg.cellColors(weights, cmap='viridis')  #Blues_r
edg.addScalarBar3D(
    title='title',
    titleFont='VictorMono',
    labelFont='VictorMono',
    c='k',
)
edg.scalarbar.addPos(0.1, 0, 0).useBounds()

show(pts,
     edg,
     axes=True,
     sharecam=True,
     bg2="white",
     at=0,
     zoom=1.2,
     )

And I’d like to rotate the axes - shift the z-axis in place of the x-axis e.g.

image

I’d like to know how this can be done so that the axes grid looks like the first plot. I looked at mesh.py in the repo that uses RotateWXYZ. However, I am not sure how to use it for the example mentioned above.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:16 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
marcomusycommented, Mar 3, 2021

…depending on the meaning of the graph is looks technically reasonable to me! 😃

1reaction
marcomusycommented, Mar 7, 2021

if you want to rotate everything why not rotating the camera? show(nx_pts, nx_edg, nx_pts.labels('id'), axes=True, bg='w', title='plot', roll=90)

PS; change .addScalarBar(title='$\mu$') to .addScalarBar(title='\mu')

Read more comments on GitHub >

github_iconTop Results From Across the Web

Rotate axis text in python matplotlib - Stack Overflow
pyplot figure class that automatically rotates dates appropriately for you figure. You can call it after you plot your data (i.e. ax.plot(dates,ydata) :...
Read more >
Rotate Tick Labels in Matplotlib - Stack Abuse
Now, let's take a look at how we can rotate the X-Axis tick labels here. There are two ways to go about it...
Read more >
How to rotate a simple matplotlib Axes? - Tutorialspoint
To rotate a simple matplotlib axes, we can take the following steps −. Import the required packages −. import matplotlib.pyplot as plt ...
Read more >
How to Rotate X-Axis Tick Label Text in Matplotlib?
Rotate X-Axis Tick Label Text using ax.set_xticklabels(). In this example, we will rotate X-axis labels individually by using the built-in ax.
Read more >
Rotate Axis Labels of Base R Plot (3 Examples)
In this article, I'll explain how to rotate axis labels of a Base R plot in the R programming language. The content of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found