Plotting a Helix in Sympy: Troubleshooting and Tips

In summary, the conversation is about a user experiencing problems with their Stack Overflow account due to their IP address being used by others, which limits the number of questions they can ask. They ask for help with plotting a helix in SymPy and provide a link to their question. Another user suggests a code example and asks if the user is able to produce plots otherwise, and shares a link for more information. The user then tries the example but gets a strange outcome and asks for help. The conversation ends with the user providing details of their setup and thanking the other user for their help.
  • #1
JD_PM
1,131
158
I asked this question on SO, but I am having problems with it (I cannot even get into my account now). It seems that people using the IP I am using are asking a lot and that limits the number of questions I can ask. Please have a look at my question. Here's the link:
[Moderators note: bold large formatting removed. Please use plain text in PF posts.]
https://stackoverflow.com/questions/55576155/how-to-plot-a-helix-in-sympy
After seeing that comment I have tried:

>>>x = sp.symbols('x')
>>>sp.plotting.plot3d_parametric_line(sp.cos(x),sp.sin(x),x, (x,0,10))

But got not plot:

<sympy.plotting.plot.Plot at 0x29104c282e8>

Any help is appreciated.
 
Last edited by a moderator:
Technology news on Phys.org
  • #3
DrClaude said:
Can you otherwise produce plots? Because the code you wrote works for me.

You can get more information on the plotting command at
https://docs.sympy.org/latest/modules/plotting.html#sympy.plotting.plot.plot3d_parametric_line

Thanks.

Following the same example SymPy provides us with I got the same kind of outcome:

Screenshot (323).png


A weird (for me of course, I have just started with SymPy) outcome between <>.

What am I missing?
 
  • #4
It appears that your python installation is not capable of opening a window for plotting.

You'll have to give details of your setup.
 
  • Like
Likes JD_PM
  • #6
JD_PM said:
I use Jupyter Notebook for running code.
I found this:
 
  • Like
Likes jim mcnamara and JD_PM
  • #7
DrClaude said:
I found this:

Thanks, now fixed! :)

Screenshot (324).png
 

1. How do I define a helix in Sympy?

To define a helix in Sympy, you can use the Curve class and specify the parametric equations for the helix. For example, if the helix has a radius of r and a pitch of p, the parametric equations would be x = r*cos(t), y = r*sin(t), and z = p*t.

2. Can I plot multiple helices in Sympy?

Yes, you can plot multiple helices in Sympy by defining each helix as a separate Curve object and then using the plot function to plot all of them together. You can also specify different colors and styles for each helix to differentiate them.

3. How do I change the size and orientation of the helix plot?

To change the size and orientation of the helix plot, you can use the aspect_ratio and rotation parameters in the plot function. The aspect_ratio parameter allows you to adjust the scale of the plot, while the rotation parameter allows you to rotate the plot in the specified direction.

4. Can I add labels and a title to the helix plot?

Yes, you can add labels and a title to the helix plot by using the legend and title parameters in the plot function. The legend parameter allows you to add a legend with labels for each helix, and the title parameter allows you to add a title for the entire plot.

5. How can I save the helix plot as an image file?

To save the helix plot as an image file, you can use the save function and specify the desired file format. For example, if you want to save the plot as a PNG file, you can use the command save('helix_plot.png'). This will save the plot in the same directory as your code.

Similar threads

  • Programming and Computer Science
Replies
4
Views
3K
  • Programming and Computer Science
Replies
2
Views
1K
  • Programming and Computer Science
Replies
3
Views
311
  • Programming and Computer Science
Replies
2
Views
3K
  • Programming and Computer Science
Replies
1
Views
958
  • Programming and Computer Science
Replies
1
Views
2K
  • Programming and Computer Science
Replies
3
Views
1K
  • Programming and Computer Science
Replies
11
Views
2K
  • Programming and Computer Science
Replies
4
Views
4K
  • Programming and Computer Science
Replies
2
Views
1K
Back
Top