How can I rotate the xyz axis in TikZ using the tdplotsetmaincoords command?

  • Context: MHB 
  • Thread starter Thread starter Dustinsfl
  • Start date Start date
Click For Summary
SUMMARY

The discussion focuses on using the \tdplotsetmaincoords command in TikZ to effectively rotate the xyz axis for improved visualization in 3D graphics. By applying the command with parameters {72}{120}, users can maintain the standard coordinate orientation without needing to swap the x and z coordinates. This method enhances the appearance of 3D plots while allowing for customizable angles. The solution is particularly beneficial for those seeking to optimize their TikZ graphics.

PREREQUISITES
  • Familiarity with TikZ for LaTeX
  • Understanding of 3D coordinate systems
  • Basic knowledge of LaTeX syntax
  • Experience with graphical representation in documents
NEXT STEPS
  • Explore advanced TikZ features for 3D plotting
  • Learn about customizing TikZ styles and colors
  • Investigate the \tdplotsetmaincoords command variations
  • Review documentation on 3D coordinate transformations in LaTeX
USEFUL FOR

This discussion is beneficial for LaTeX users, graphic designers, and researchers who utilize TikZ for creating 3D visualizations in their documents.

Dustinsfl
Messages
2,217
Reaction score
5
I am not sure if you all who use tikz are aware of this but here is what I figured out today.

I am sure those of you who use tikz know that when you do (x,y,z) the z axis is where the x-axis usually is in 3D. You could always rename it but then you have to remember to swap coordinates x and z. Additionally, the appearance would be nicer if we could rotate the axis.

[LATEXS]
\tdplotsetmaincoords{72}{120}
\begin{tikzpicture}[line join = round, line cap = round, >=triangle 45, tdplot_main_coords]
[/LATEXS]
This will set the xyz axis in the normal position with a better appearance. This way you don't have to swap the x and z in (x,y,z).
 
Last edited:
Physics news on Phys.org
Also, the angles can be changed to whatever you want.\end{tikzpicture}I hope this helps anyone who was looking for a way to rotate the xyz axis in tikz.
 

Similar threads

Replies
5
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 0 ·
Replies
0
Views
6K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K