2

First off, I'm total novice at this.

I have a graph like :

this

And I want to rotate this plotted graph along the x-axis to get something like:

this

So Is there a way/online tool /piece of code to do this kind of operation(rotation along any axis) in TeXStudio using Tikz-PGF, LaTex or do I have to write complete code for the output myself? Please suggest.

PS: I have to work with both 2D/3D graphs.

4

Run with pdflatex --shell-escape <file>

\documentclass{article}
%\usepackage[pspdf={-dALLOWPSTRANSPARENCY}]{pstricks-pdf}% GhostScript 9.53
\usepackage[pspdf={-dNOSAFER}]{pstricks-pdf}%  < 9.53
\usepackage{pst-func}
\begin{document}

\psset{xunit=2} 
\begin{pspicture}(-0.5,-4)(4,4)
\psaxes{->}(0,0)(0,-4)(3,4) 
\psVolume[linecolor=black!40,fillstyle=solid,
    fillcolor=yellow!40,opacity=0.4](0.5,2){12}{x sqrt 2 mul} 
\psplot[algebraic,linecolor=red,linestyle=dashed]{0}{2}{2*sqrt(x)}
\psplot[algebraic,linecolor=red,linestyle=dashed]{0}{2}{-2*sqrt(x)}
\psplot[algebraic,linecolor=red,linewidth=1pt]{0.5}{2}{2*sqrt(x)}
\pscustom[opacity=0.4,fillstyle=solid,fillcolor=red,linestyle=none]{%
  \psplot[algebraic]{0.5}{2}{2*sqrt(x)}
  \psline(2,0)(0.5,0)}
\uput[0](2.1,2.8){\textcolor{red}{$y=2\cdot\sqrt{x}$}}
\psline(2,0)(3,0)
\end{pspicture}

\end{document}

enter image description here

7
  • As I said, I'm total novice at this. So can you please do me the favour of explaining this pdflatex command? Jun 20 '20 at 5:46
  • @JustCurious: You don't know how to use pdflatex from within TeXStudio? Jun 21 '20 at 13:49
  • Package pst-pdf Warning: File `pdf-pics.pdf' not found. is the error I get after running it from shell. What should I do next? @MoneyOrientedProgrammer Jun 22 '20 at 4:10
  • 1
    @JustCurious: Remove the first two \usepackage in the code above and leave the last one which is \usepackage{pst-func}. Now compilet the file with xelatex filename.tex. It takes several seconds to finish. If you want to save time, invoke the following latex filename.tex, dvips filename.dvi and ps2pdf filename.ps in the order I wrote. Jun 22 '20 at 5:31
  • @JustCurious: latex.userpage.fu-berlin.de/TeXstudio-Konfiguration.pdf shows the configuration of TeXStudio (see page 11 for inserting the --shell-escape option).
    – user187802
    Jun 22 '20 at 6:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.