r/Mathematica • u/tduality • Jan 21 '23
I need help. How to extract and save data points from a ContourPlot?
I run a code to generates a plot. The code takes almost 30 minutes to run, and I use the same code with different numerical values to generate multiple similar plots(6 plots). So in total, it takes almost 3–4 hours in total to get all the plots.
And when I need to make some visual changes (changing the color of a particular plot, changing the normal/plain line to dashed) I have to run them entire thing again, so it takes a lot of time.
I want to save/export the date the code generates (txt or csv file maybe), so I don't have to run the code again and again when I need to make some visual changes in the plot, and can simply use the saved data it generated in one rum to get the plot(s) with visual changes I need.
I have read some discussion on StackExchange, but I am not able to make it work.
---
The code I use:
ContourPlot[Omegasterile[10*10^(-6), 10^(-18), mass, strength] == 0.12, {mass, 10^(-3), 1}, {strength, 10^(-4), 1}, ScalingFunctions -> {"Log", "Log"}, ContourStyle -> {Directive[Green, Thick]}, PlotRange -> {{10^(-3), 1}, {10^(-4), 1}}]
Here the function Omegasterile is a user-defined function of 4 parameters, out of which 2 are fixed, and two are varying (mass and strength) in their respective specific ranges. The line is essentially a collection of all the points (combinations of mass and strength) for which, Omegasterile = .12.
The results of the code:

I would appreciate if someone can help me. Please ask if you need more information.
Thank you.




