Group Abstract Group Abstract

Message Boards Message Boards

0
|
7.2K Views
|
12 Replies
|
8 Total Likes
View groups...
Share
Share this post:

How to display latitude and longitude lines on the sphere?

Posted 6 years ago
POSTED BY: Qiu Mianp
12 Replies
Posted 6 years ago

My picture I have a set of codes, and the picture drawn is a circle on a sphere, as shown. But there are no longitude and latitude lines on the sphere. I hope there are longitude and latitude lines on the sphere. How to modify the code?

My code

POSTED BY: Qiu Mianp
Posted 6 years ago

Hi z z,

Is this what you are trying to do?

plot = ParametricPlot3D[FromSphericalCoordinates[{1, Pi/2 - β, α}], {α, -Pi, Pi}];

sphere = SphericalPlot3D[1, {t, 0, Pi}, {p, 0, 2*Pi},
   PlotStyle -> Directive[White, Opacity[0.2]],
   Mesh -> 12,
   MeshStyle -> Opacity[0.3],
   Axes -> False,
   Boxed -> False];

Show[sphere, plot]

enter image description here

POSTED BY: Rohit Namjoshi
Posted 6 years ago

Very good, I want this result. thank you very much. Will this code be added to my code? I use a mobile phone to operate, why can't I paste it, but must enter these codes manually?

POSTED BY: Qiu Mianp
POSTED BY: EDITORIAL BOARD

Perhaps you could describe your problem.

Did you copy/paste the code given above in a notebook? Is it this what you want?

POSTED BY: Hans Dolhaine

And here something more explicit

long = Table[j Pi/180., {j, -90, 90, 20}];
lat = Table[j Pi/180., {j, 0, 30, 10}];
longc = ParametricPlot3D[{Cos[#] Sin[y], Sin[#] Sin[y], Cos[y]}, {y, 
      0, Pi}, PlotStyle -> {Red, Thick}] & /@ long;
latc = ParametricPlot3D[{Cos[x] Sin[Pi/2 - #], Sin[x] Sin[Pi/2 - #], 
      Cos[Pi/2 - #]}, {x, 0, 2 Pi}, PlotStyle -> {Thick, Blue}] & /@ 
   lat;
ps = ParametricPlot3D[{Cos[x] Sin[y], Sin[x] Sin[y], Cos[y]}, {x, 0, 
    2 Pi}, {y, 0, Pi},
   Boxed -> False,
   PlotPoints -> 30,
   Axes -> False,
   Mesh -> False
   ];
Show[ps, longc, latc]

You might adapt this according to your needs.

POSTED BY: Hans Dolhaine
Posted 6 years ago

Sorry, I do n’t know how to copy my code and export it here. My code

POSTED BY: Qiu Mianp

Don't post a screenshot but code so that it is possible to have a look at it. What do you want to do? That is by no means clear!

POSTED BY: Hans Dolhaine
Posted 6 years ago

How to add your latitude and longitude code to my code?

POSTED BY: Qiu Mianp

Do you mean this perhaps?

ParametricPlot3D[{Cos[x] Sin[y], Sin[x] Sin[y], Cos[y]}, {x, 0, 
  2 Pi}, {y, 0, Pi},
 Boxed -> False,
 PlotPoints -> 30,
 Axes -> False,
 Mesh -> {10, 20}]
POSTED BY: Hans Dolhaine
Posted 6 years ago

Can this code be imported into Wolfram? How to import?

POSTED BY: Qiu Mianp

Just copy and paste

POSTED BY: Hans Dolhaine