Group Abstract Group Abstract

Message Boards Message Boards

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

How to display latitude and longitude lines on the sphere?

Posted 5 years ago

I have this code, I want to display the latitude and longitude lines on the sphere, how can I achieve it?

\[Beta]=ArcTan[Sin[\[Alpha]]]+ArcTan[-.7]/Sqrt[Sin[\[Alpha]]^2+1];Show[Graphics3D[{Opacity[.5],Sphere[]}],ParametricPlot3D[FromSphericalCoordinates[{1,Pi/2-\[Beta],\[Alpha]}],{\[Alpha],-Pi,Pi}]]

Show[%1,Background->RGBColor[0.84,0.92,1.]]


ParametricPlot3D
POSTED BY: Qiu Mianp
12 Replies
Posted 5 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 5 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 5 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

Welcome to Wolfram Community! Please make sure you know the rules: https://wolfr.am/READ-1ST

The rules explain how to format your code properly. If you do not format code, it may become corrupted and useless to other members. Please EDIT your post and make sure code blocks start on a new paragraph and look framed and colored like this.

int = Integrate[1/(x^3 - 1), x];
Map[Framed, int, Infinity]

You can also embed notebook or attach notebook.

enter image description here

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 5 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 5 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 5 years ago

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

POSTED BY: Qiu Mianp

Just copy and paste

POSTED BY: Hans Dolhaine