-
-
Save tdegris/d1844e7c209d77962ecc891b47d3a04a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"image/color" | |
"gonum.org/v1/plot" | |
"gonum.org/v1/plot/plotter" | |
"gonum.org/v1/plot/vg" | |
"gonum.org/v1/plot/vg/draw" | |
) | |
var data = plotter.XYs{ | |
{1e-05, 2.2329354607370155}, | |
{1.4e-05, 2.232795669016382}, | |
{1.96e-05, 2.23261351089736}, | |
{2.7439999999999995e-05, 2.2323610415457056}, | |
{3.841599999999999e-05, 2.2320040476763356}, | |
{5.378239999999999e-05, 2.231498244265366}, | |
{7.529535999999997e-05, 2.2307779280183153}, | |
{0.00010541350399999995, 2.2297512056733133}, | |
{0.00014757890559999993, 2.228301922372411}, | |
{0.0002066104678399999, 2.2262814820920194}, | |
{0.00028925465497599983, 2.2234880631352563}, | |
{0.00040495651696639975, 2.2196445832451777}, | |
{0.0005669391237529596, 2.214374910071904}, | |
{0.0007937147732541434, 2.207165889418931}, | |
{0.0011112006825558006, 2.197335835263894}, | |
{0.0015556809555781208, 2.184045130797695}, | |
{0.002177953337809369, 2.1663267461903883}, | |
{0.003049134672933116, 2.1430876049119294}, | |
{0.004268788542106362, 2.113082254658815}, | |
{0.005976303958948907, 2.075037220276257}, | |
{0.00836682554252847, 2.0282359894572854}, | |
{0.011713555759539857, 1.9736202730604633}, | |
{0.016398978063355798, 1.9151075171589704}, | |
{0.022958569288698116, 1.8613397395462787}, | |
{0.03214199700417736, 1.8301193938765483}, | |
{0.0449987958058483, 1.8640803414571374}, | |
{0.06299831412818761, 2.117014297002639}, | |
{0.08819763977946266, 5.881065660430223}, | |
} | |
func main() { | |
p := plot.New() | |
p.Title.Text = "Example" | |
p.X.Label.Text = "X" | |
p.X.Scale = plot.LogScale{} | |
p.X.Tick.Marker = plot.LogTicks{} | |
p.Y.Label.Text = "Y" | |
p.Y.Scale = plot.LogScale{} | |
p.Y.Tick.Marker = plot.LogTicks{} | |
p.Add(&plotter.Line{ | |
XYs: data, | |
LineStyle: draw.LineStyle{ | |
Color: color.RGBA{46, 113, 173, 255}, | |
Width: vg.Points(2), | |
Dashes: []vg.Length{}, | |
DashOffs: 0, | |
}, | |
}) | |
// Save the plot to a PNG file. | |
if err := p.Save(4*vg.Inch, 4*vg.Inch, "noylabels.png"); err != nil { | |
panic(err) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment