7

In my attempts to practice Julia, I've made a program which draws a bifurcation diagram. My code is as follows:

function bifur(x0,y0,a=1.3,b=0.4,n=1000,m=10000)
    i,x,y=1,x0,y0
    while i < n && abs(x) < m
        x,y = a - x^2 + y, b * x
        i += 1
    end
    if abs(x) < m
        return x
    else
        return 1000
    end
end
la = Float64[];
lx = Float64[];
for a=0:400
    for j = 1:1000
        x0 = rand()
        y0 = rand()
        x = bifur(x0,y0,a/100)
        if x != 1000
            push!(la,a/100) 
            push!(lx,x)
        end
    end
end
using Gadfly
myplot = Gadfly.plot( x=la, y=lx , Scale.x_discrete, Scale.y_continuous, Geom.point)
draw(PNG("myplot.png",10inch,8inch),myplot)

The output I get is this image: enter image description here

In order to make my plot look more like this: enter image description here I need to be able to set point sizes to as small as one pixel. Then by increasing the iteration length I should be able to get a better bifurcation diagram. Does anyone know how to set the point sizes in Gadfly diagrams in Julia?

Ali
  • 503
  • 6
  • 20
  • Have you tried changing the `default_point_size` in the [Theme](http://gadflyjl.org/themes.html) defaults? – rickhg12hs Sep 03 '14 at 15:31
  • Also do you know how to set the plot range by hand? – Ali Sep 03 '14 at 15:45
  • 1
    Have a look at the [Scale params](http://gadflyjl.org/scale_y_continuous.html). Also wondering if you can set `ymin` and/or `ymax`, etc. – rickhg12hs Sep 03 '14 at 18:58

1 Answers1

6

[Just to encapsulate the comments as an answer...]

Gadfly's Theme defaults can be changed. In particular, point_size is probably what you are looking for.

For changing the automatic plot scale/range settings, have a look at Gadfly's Scale params.

Ali
  • 503
  • 6
  • 20
rickhg12hs
  • 10,638
  • 6
  • 24
  • 42
  • @Cokes: Thanks! Links are fixed now. – rickhg12hs Mar 23 '17 at 20:56
  • Links are broken again and I think Gadfly has changed some of these options. http://gadflyjl.org/stable/man/themes/ – Ali Oct 20 '19 at 22:09
  • @Ali I've marked the answer as "community wiki". Please feel free to update this answer or to provide a new one. I'm not currently using Gadfly. – rickhg12hs Oct 20 '19 at 23:41