Graphics, Figures & TablesSpherical coordinates figure

Information and discussion about graphics, figures & tables in LaTeX documents.
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

Spherical coordinates figure

Post by Cham »

I would like to reproduce (with some variations) the last picture shown there :

https://tex.stackexchange.com/questions ... oordinates
sph_coords.jpg
sph_coords.jpg (21.1 KiB) Viewed 5489 times
I'm yet unable to compile any of the codes given there (they give me some compilation fatal error).

I would like to change the orientation of that picture so it looks more horizontal (the axes are tilted, on the picture above. The z axis should be vertical). I'm not sure I like the gray sphere, which is a bit useless, and I prefer to place the $d\phi$ and its line just under the two vertical arches.

Also, the angles should be $\vartheta$ and $\varphi$, instead of $\theta$ and $\phi$.

The position of $dr$ and $r d\theta$ could also be better, with their ugly dotted lines.

Ideally, I would open the compiled PDF with my vectorial drawing editor to change the lines thickness, colors and arrows, so I think it could be better to reproduce that picture without any arrows and symbols, so the code should be much simpler (I would add the elements in my vectorial drawing editor).

Any idea about this ?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
TikZ book
User avatar
Stefan Kottwitz
Site Admin
Posts: 10315
Joined: Mon Mar 10, 2008 9:44 pm

Spherical coordinates figure

Post by Stefan Kottwitz »

Hi Cham,
Cham wrote:they give me some compilation fatal error
what errors did you get? If it's something like a TikZ package or library is missing or reason not directly related to the code, also our code might not help. We should see the error message.

Stefan
LaTeX.org admin
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

Spherical coordinates figure

Post by Cham »

I'm getting this, in the console :
Package asymptote Warning: file `TSWLatexianTemp_000277-1.pdf' not found on input line 92.

(./TSWLatexianTemp_000277.aux) )
No pages of output.
Transcript written on TSWLatexianTemp_000277.log.
The log file is this one :
TSWLatexianTemp_000858.log
(7.13 KiB) Downloaded 330 times
I don't know what to do with this.

Take note that the figure I would prefer to get is much simpler : no symbols, no gray regions, no arrows, and the two dotted lines should be removed. The small curvy line at the bottom and associated to $d\phi$ should be at the base of their vertical arches. The offset is useless and ugly. The figure should not be tilted to the left.

All lines may have the same thickness.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10315
Joined: Mon Mar 10, 2008 9:44 pm

Spherical coordinates figure

Post by Stefan Kottwitz »

Here Asymptote is used. That is an external program, usually included in a TeX distribution. However, you need to run pdfLaTeX with --shell-escape option then. Do you know how that works? Or run asy at the command prompt. You may need to have a look at the Asymptote manual.

Or switch to TikZ if you don't need real 3d coordinates. You may make a hand-drawn picture first, to let us know, how the picture should look like, and if possible make a start with that.

Stefan
LaTeX.org admin
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

Spherical coordinates figure

Post by Cham »

Oh no, I don't want to enter an external program and all that stuff !

I think TikZ could do 3D stuff all by itself (see this page : http://texample.net/tikz/examples/tag/3d/). The picture I need is the same as the one shown in the first message above, in a simpler version without all the small details (see my previous message).

EDIT : The code there is working, but it's too complex and not exactly what I need : http://texample.net/tikz/examples/spher ... ian-grids/

Or if you could compile exactly the first picture as it is and send it to me in a PDF (vectorial) version, that would be awesome ! I could then open it in my vectorial drawing app, and edit it.
rais
Posts: 419
Joined: Sun Nov 16, 2014 8:51 pm

Spherical coordinates figure

Post by rais »

Cham wrote:Oh no, I don't want to enter an external program and all that stuff !
what's the problem?
Assuming "foo.tex" for your TeX file containing asymptote ({asy}) code, just run
pdflatex foo.tex
Here, you'll get the message, ``Package asymptote Warning: file `foo-1.pdf' not found on...'', that is to be expected; you haven't created it, yet. However, a file `foo-1.asy' should have been created. Run
asy foo-1.asy
which may take a little while, but when it finished, just run
pdflatex foo.tex
again. This time, you shouldn't get the warning message from above...

@Stefan: I don't think asymptote is geared to work with --shell-escape, that is: I couldn't find a hint in that regard in the asymptote's manual.
Then again, I haven't seen asymptote code before this post (well, or I've forgotten about seeing it before).

KR
Rainer
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

Spherical coordinates figure

Post by Cham »

I really don't know how to do this kind of stuff. This is pretty advanced, for my squirrel brain ! :oops:
rais
Posts: 419
Joined: Sun Nov 16, 2014 8:51 pm

Spherical coordinates figure

Post by rais »

What, a three-step compilation, advanced? Considering BibTeX/biber, makeindex/xindy, it sounds pretty basic to me.
I still don't see---now even less than before---where your problem is.

KR
Rainer
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

Spherical coordinates figure

Post by Cham »

I don't know the basic steps. This is totally new to me, so how do you think I could do this by myself without clear instructions ?

At least, show me the steps ! I cannot find this from mid air ! Why do you think I'm asking here !?

Your "instructions" above are kryptic. They are useless.
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Spherical coordinates figure

Post by Johannes_B »

They are the first and essential steps to compile any LaTeX document and are introduced in any beginers material.

Maybe you text editor calls the tosfor you, i don't know.

What you are trying to achieve is much much more complex. You have been asking for a more simple way for what you are trying, this tells me you have not yet understood the cimplexity of creating figures programatically.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Post Reply