[julia-users] Re: Announcement: JuliaBio SIG

2014-02-06 Thread Daniel Jones
Hi Cory,

A few us just started an organization with a similar intent just a couple 
weeks ago: https://github.com/BioJulia

There has been some planning and ongoing discussion at: 
https://groups.google.com/forum/?fromgroups#!forum/biojulia-dev

I don't mean to preempt you, but I hope you'll join forces with us. We have 
some great stuff cooking and we'd love your input.

On Wednesday, February 5, 2014 8:39:47 PM UTC-8, Roger Herikstad wrote:
>
> Hi!
>  I'm a neuroscientist by trade and I would definitely be interested in 
> this initiative. I've already started translating/rewriting some of our 
> in-house analysis code from Matlab/Python to Julia (mostly information 
> theory/neural coding related stuff) and I would be happy to share whatever 
> I have that might be of more general interest. Thanks for starting this!
>
> On Thursday, February 6, 2014 11:57:28 AM UTC+8, Cory Giles wrote:
>>
>> Julia shows great promise for biology and bioinformatics-related 
>> programming. It really blows the competition (Python, R) out of the water 
>> in terms of language design, but a lot of work is needed to catch up to the 
>> huge library advantage that's available in these languages.
>>
>>  I've set up a GitHub organization and Google Group for anyone interested 
>> to discuss how we can make Julia a viable platform for bioinformatics 
>> moving forward. Everyone is welcome, 
>> *especially*non-biologists/bioinformaticians. Biologists are not known for 
>> being the 
>> best programmers in the world, so we can definitely use input from skilled 
>> programmers as well as specialists in the field.
>>
>> - https://github.com/JuliaBio
>> - https://groups.google.com/forum/#!forum/julia-bio
>>
>

[julia-users] Re: Multiple plots in one (pdf) file?

2014-02-07 Thread Daniel Jones
There's not a way to put them on separate pdf pages, but you can stack them 
and output them to the same pdf like:

using Gadfly
x = [1,2,3]
plot1 = plot(x = x, y = x + 3)
plot2 = plot(x = x, y = 2 * x + 1)
draw(PDF("plotJ.pdf", 6inch, 6inch), vstack(plot1, plot2))


On Friday, February 7, 2014 8:35:57 AM UTC-8, G. Patrick Mauroy wrote:
>
> Just starting taking a look at Julia.  I have seen examples on how to send 
> a plot to a file.  But I have not stumbled upon one example as yet to 
> export multiple plots to the same file, say pdf.
> Can someone please point me in the right direction?
>
> # R example of what I would like to do.
>
> x = 1:3
>
> pdf(file = "plotR.pdf")
>
> plot(x = x, y = x + 3)
>
> plot(x = x, y = 2 * x + 1)
>
> dev.off()
>
>
> # My first Julia attempt.
>
> using Gadfly
>
> x = [1,2,3]
>
> plot1 = plot(x = x, y = x + 3)
>
> plot2 = plot(x = x, y = 2 * x + 1)
>
> draw(PDF("plotJ.pdf", 6inch, 3inch), plot1)
>
> draw(PDF("plotJ.pdf", 6inch, 3inch), plot2)
>
>
> Pb: plot2 overrides plot1, so only plot2 in plotJ.pdf.
>
>
> To be clear, in this example, I want plot1 & plot2 in two distinct 
> plots/pages -- as opposed to merge both graphs into one plot.
>
>
> Thanks.
>
>

[julia-users] Re: Plotting matrices a la imagesc() using Gadfly?

2014-02-13 Thread Daniel Jones
There's actually a special function "spy" to make plotting matrices 
simpler, where spy(M) returns a plot. All that function does is basically 
call findnz on the matrix and pass the result to x, y, and color in the 
regular plot function.

Special handling of matrix arguments is something to consider though.

On Thursday, February 13, 2014 4:38:16 PM UTC-8, Elliot Saba wrote:
>
> Hey there, I'm trying to use Gadfly's Geom.binrect to plot a matrix, but I 
> can't figure out how to do it without going through a lot of rigamarole to 
> generate a DataFrame like is used in the 
> example
>  docs.
>
> I have, say, a 10x10 matrix:
>
> z = randn(10,10)
>
> In matlab, if I wanted to plot it, I would just imagesc(z).  I know that 
> if I had a dataframe with a row for each point in z stored in a column, and 
> the x/y coordinates recorded in their own columns, I could coerce Gadfly to 
> plot what I want as shown in the example.  But is there a simpler way to do 
> this?  I've tried something like:
>
> plot(x=1:10, y=1:10, color=z, Geom.rectbin)
>
> But Gadfly just plots one pixel for each x and y passed in.  I understand 
> why it's doing that, I just don't know the easiest way to get it to treat z 
> as a matrix, instead of a vector.
>
> Thanks,
> -E
>


Re: [julia-users] Re: Plotting matrices a la imagesc() using Gadfly?

2014-02-13 Thread Daniel Jones
I just tagged a new version that should fix the scales and let spy take 
arguments like plot (so you can change the axis labels, etc).

You didn't miss spy in the documentation, it's not there, though it should 
be.

On Thursday, February 13, 2014 5:08:52 PM UTC-8, Elliot Saba wrote:
>
> Hmm, that picture didn't seem to embed nicely.  Here's another shot at it.
>
>
> On Thu, Feb 13, 2014 at 5:08 PM, Elliot Saba 
> > wrote:
>
>> Also, is there a way to get the axes to line up a little better?  I want 
>> to tell spy() that it should start a 1 and not 0, as it seems to want to 
>> do.  This is what it looks like right now:
>>
>>
>>
>> I'd like to edit the xlabel and ylabel, but spy() doesn't seem to take in 
>> arguments, (only a matrix) and the Gadfly documentation doesn't seem to 
>> talk about how to modify a plot object after it's been created.
>>
>>
>> On Thu, Feb 13, 2014 at 4:59 PM, Elliot Saba 
>> > wrote:
>>
>>> Great, spy() is exactly what I wanted!  Is it documented anywhere, or 
>>> did I just miss it?
>>> -E
>>>
>>>
>>> On Thu, Feb 13, 2014 at 4:47 PM, Daniel Jones 
>>> 
>>> > wrote:
>>>
>>>> There's actually a special function "spy" to make plotting matrices 
>>>> simpler, where spy(M) returns a plot. All that function does is basically 
>>>> call findnz on the matrix and pass the result to x, y, and color in the 
>>>> regular plot function.
>>>>
>>>> Special handling of matrix arguments is something to consider though.
>>>>
>>>> On Thursday, February 13, 2014 4:38:16 PM UTC-8, Elliot Saba wrote:
>>>>>
>>>>> Hey there, I'm trying to use Gadfly's Geom.binrect to plot a matrix, 
>>>>> but I can't figure out how to do it without going through a lot of 
>>>>> rigamarole to generate a DataFrame like is used in the 
>>>>> example<https://github.com/dcjones/Gadfly.jl/blob/master/doc/geom_rectbin.md>
>>>>>  docs.
>>>>>
>>>>> I have, say, a 10x10 matrix:
>>>>>
>>>>> z = randn(10,10)
>>>>>
>>>>> In matlab, if I wanted to plot it, I would just imagesc(z).  I know 
>>>>> that if I had a dataframe with a row for each point in z stored in a 
>>>>> column, and the x/y coordinates recorded in their own columns, I could 
>>>>> coerce Gadfly to plot what I want as shown in the example.  But is there 
>>>>> a 
>>>>> simpler way to do this?  I've tried something like:
>>>>>
>>>>> plot(x=1:10, y=1:10, color=z, Geom.rectbin)
>>>>>
>>>>> But Gadfly just plots one pixel for each x and y passed in.  I 
>>>>> understand why it's doing that, I just don't know the easiest way to get 
>>>>> it 
>>>>> to treat z as a matrix, instead of a vector.
>>>>>
>>>>> Thanks,
>>>>> -E
>>>>>
>>>>
>>>
>>
>

Re: [julia-users] Re: printf macro doesn't accept triple-quoted strings, is this a bug?

2014-02-17 Thread Daniel Jones
I made one a while back: https://github.com/JuliaLang/julia/issues/2682

On Monday, February 17, 2014 10:09:24 AM UTC-8, Stefan Karpinski wrote:
>
> Yes, we should support this. Could you open an issue for this feature?
>
>
> On Mon, Feb 17, 2014 at 12:39 PM, Ivar Nesje 
> > wrote:
>
>> It seems like it translate to @mstr macrocall
>>
>> macro dump(ex) 
>> dump(ex) 
>> end
>>
>> @dump("""hei""")
>>
>> Expr 
>>   head: Symbol macrocall
>>   args: Array(Any,(2,))
>> 1: Symbol @mstr
>> 2: ASCIIString "hei"
>>
>> Ivar
>>
>>
>> typ: Anykl. 18:31:53 UTC+1 mandag 17. februar 2014 skrev Ismael VC 
>> følgende:
>>
>>> julia> color = "red"
>>> "red"
>>>
>>> julia> @printf """yellow
>>>   black
>>>   %s""" color
>>> ERROR: first or second argument must be a format string
>>>
>>> julia> @printf """yellow
>>>   black
>>>   %s""" "red"
>>> ERROR: no method write(ASCIIString, ASCIIString)
>>>
>>> julia> @printf """yellow black %s""" "red"
>>> ERROR: no method write(ASCIIString, ASCIIString)
>>>
>>> julia> @printf """yellow black %s""" color
>>> ERROR: first or second argument must be a format string
>>>
>>> julia> @printf "yellow black %s" color
>>> yellow black red
>>> julia> @printf "yellow black %s" "red"
>>> yellow black red
>>>
>>
> 

[julia-users] Re: "Filled" regions in Gadfly

2014-02-17 Thread Daniel Jones
There wasn't a way to do this, so I just added one: 
http://dcjones.github.io/Gadfly.jl/geom_ribbon.html


On Monday, February 17, 2014 5:06:54 AM UTC-8, Tom Nickson wrote:
>
>
> When regressing, I quite like to plot my variance as a filled region 
> behind the mean - as in this example from the GPML website.
> 
> assuming I had data:
>
> x, mean, std_dev 
>
> and I wanted to plot mean against x and (mean +/- std_dev) against x as a 
> filled regions, how would I set up my dataframe and call plot?
>
> Double points if everything comes up nicely on the plot legend!
>
> Tom
>
>

[julia-users] Re: Unable to use Gadfly with latest v0.3.0-prerelease-e8a3368070

2014-02-24 Thread Daniel Jones
You're not doing anything wrong. There were some changes made to julia a 
couple days ago that I haven't caught up with yet. I'll get it fixed and 
tag a new version sometime tomorrow.

In the meantime, it'll work if you build a slightly older version of julia (git 
checkout b2fea25f2b693fd848277df78c7a794dee7054a0, should do it).

On Sunday, February 23, 2014 10:35:18 PM UTC-8, Ben Mabey wrote:
>
> Hi all,
> I'm checking out Julia tonight for the first time and I've liked what I've 
> seen so far.  Everything has gone smoothly except for using Gadfly.
>
> I'm running OSx 10.9.1 and I downloaded the latest prerelease build which 
> was  v0.3.0-prerelease-e8a3368070.  I ran Pkg.add("Gadfly") and 
> Pkg.add("Cario").  Both seemed to run fine but 'using Gadlfly' issues 
> deprecation warnings:
>
> using Gadfly
> WARNING: Set(a,b...) is deprecated, use Set({a,b...}) instead.
>  in depwarn at deprecated.jl:29
>  in Set at deprecated.jl:19
>  in include at boot.jl:243
>  in include_from_node1 at loading.jl:120
>  in include at boot.jl:243
>  in include_from_node1 at loading.jl:120
>  in reload_path at loading.jl:144
>  in _require at loading.jl:59
>  in require at loading.jl:46
>  in include at boot.jl:243
>  in include_from_node1 at loading.jl:120
>  in reload_path at loading.jl:144
>  in _require at loading.jl:59
>  in require at loading.jl:43
>
> The warnings seem minor but when I try to use Gadfly I get an error within 
> Set:
>
> julia> draw(SVG("output.svg", 6inch, 3inch), plot([sin, cos], 0, 25))
> ERROR: no method start(Symbol)
>  in union! at set.jl:26
>  in Set at set.jl:11
>  in render at /Users/bmabey/.julia/v0.3/Gadfly/src/Gadfly.jl:504
>  in draw at /Users/bmabey/.julia/v0.3/Gadfly/src/Gadfly.jl:722
>
> Looking at ~/.julia/v0.3/Gadfly I noticed that I was on the latest tagged 
> release of v0.2.4.  So I tried going to master with Pkg.checkout("Gadfly") 
> but I got the same errors as above even with a clean REPL.
>
> What am I doing wrong?
>
> Thanks,
> Ben
>


[julia-users] Re: Weird Gadfly Problem

2014-02-26 Thread Daniel Jones
Could "Distinct" be defined somewhere interfering with the definition in 
Iterators?

On Wednesday, February 26, 2014 9:28:32 AM UTC-8, John Myles White wrote:
>
> I have a long IJulia notebook that I’m going to use for a talk tomorrow at 
> UC Davis. 
>
> At the end, I try to use Gadfly. But I hit a bug that seems to be caused 
> by the preceding code as it functions in isolation: 
>
> Specifically, 
>
> julia> plot(iris, x = :SepalLength, y = :SepalWidth, color = :Species, 
> Geom.point) 
>
> produces this error: 
>
> no method 
> Distinct{ValueIterator{Dict{Symbol,ScaleElement}}}(ValueIterator{Dict{Symbol,ScaleElement}})
>  
>
>  in render at /Users/johnmyleswhite/.julia/v0.3/Gadfly/src/Gadfly.jl:612 
>  in writemime at 
> /Users/johnmyleswhite/.julia/v0.3/Gadfly/src/Gadfly.jl:738 
>  in sprint at io.jl:468 
>  in display_dict at 
> /Users/johnmyleswhite/.julia/v0.3/IJulia/src/execute_request.jl:35 
>
> Any thoughts on what’s happening? 
>
>  — John 
>
>

[julia-users] Re: "stacked area" in Gadfly

2014-03-01 Thread Daniel Jones
There's not, but that's an important thing to have and not hard to 
implement. I'll add something soon. Here's an issue for you to 
watch: https://github.com/dcjones/Gadfly.jl/issues/215

On Saturday, March 1, 2014 3:17:15 PM UTC-8, Scott Parish wrote:
>
> Is there a way to do stacked area charts? Something like these:
>
>
> http://stackoverflow.com/questions/2225995/how-can-i-create-stacked-line-graph-with-matplotlib
>
> Thanks
>
>

Re: [julia-users] Gadfly: specifying colors for the plot of a function

2014-04-30 Thread Daniel Jones
Hi Joe,



This should do the trick:



barLayer = Gadfly.layer(x=evals,
Gadfly.Geom.histogram(bincount=bincount),
Theme(default_color=color("black")))







On Wed, Apr 30, 2014, at 09:09 PM, Joe Neeman wrote:

Hi all,

I'd like to use Gadfly produce a histogram with a function plotted on
top to show a limiting distribution. I mostly have it working, but the
histogram and the function are both blue, so it's pretty hard to read
:(

How can I force the function to plot in black (for example)? I could
only find out how to use color when passing in a DataFrame.

My code looks something like this:

evals = ... # an Array{1,Float64}
n, bincount, r = ... # various parameters
barLayer = Gadfly.layer(x=evals,
Gadfly.Geom.histogram(bincount=bincount))
circleLayer = Gadfly.layer(x -> (n / bincount / r * 4 / pi) * sqrt(r^2
- x^2), -r + 0.0001, r - 0.0001)
Gadfly.plot(barLayer, circleLayer)

Thanks,
Joe


[julia-users] Re: ANN: Coverage.jl - Code coverage tracking w/ coveralls.io

2014-05-07 Thread Daniel Jones

I've tried this out on a few repositories and it's great!

One issue I'm having, which is more of a travis question: I'm testing on 
both release and nightlies, but adding '--code-coverage' of course breaks 
the release tests, since that wasn't added until recently. Can I structure 
my .travis.yml so that the coverage is run on the nightlies tests but not 
release?



On Tuesday, May 6, 2014 7:58:54 PM UTC-7, Iain Dunning wrote:
>
> Hi all,
>
> I'd like to announce Coverage.jl https://github.com/IainNZ/Coverage.jl
>
> As of Julia 0.3, there is a command-line flag, --code-coverage, that tells 
> you how many times each line in a file is run.
>
> Coverage.jl takes this data, bundles it up, and sends it to 
> Coveralls.io, 
> a website the works with your CI system of choice to track your test 
> coverage.
>
> More information is in the README.
>
> Its pretty simple to use: after enabling tracking on Coveralls.io, change 
> your "run the tests line" to use the --code-coverage flag, then put 
> something like the following in:
>
> - julia -e 'Pkg.add("Coverage"); using Coverage; 
> Coveralls.submit(Coveralls.process_folder())'
>
> Here is a simple working example: 
> https://github.com/IainNZ/RationalSimplex.jl
>
> Its pretty basic and not really robust right now, so of course Pull 
> Requests welcome.
>
> Thanks,
> Iain
>


Re: [julia-users] Gadfly bar chart sorting / ordering

2014-05-20 Thread Daniel Jones


It should work if you add:



Scale.x_discrete(levels=["a", "b", "c"])



where ["a", "b", "c"] is a vector of the values in the order you'd like
them to appear.







On Tue, May 20, 2014, at 05:32 PM, Dan B wrote:

Friends,

I have a simple array that has counts (sorted descending) and names
associated with each count (please see screenshot).  When I plot a bar
chart with name on the X axis, and count on the Y axis, the bars get
automatically sorted alphabetically by the names on the Y axis.  I
would like to have the bars sorted ascending or descending by the Y
axis (the count), essentially to match the order that I have in the
array.  Am I missing something simple?

Thanks in advance!

- - Dan

  Email had 1 attachment:
  * BarChartOrderingIssue.png
  *   76k (image/png)


Re: [julia-users] Gadfly bar chart sorting / ordering

2014-05-20 Thread Daniel Jones
I agree, that should work. I'll try to fix it when I have a chance.



In the mean time, a work around would be to use
levels=collect(xs) where xs is your vector of names. That will
effectively convert the PooledDataArray to a regular Array, so should
work.





On Tue, May 20, 2014, at 08:25 PM, Dan B wrote:

>From one Daniel to the next - thanks! :)  This looks like exactly what
I need.  If I try manually constructing a vector with the names like
you did, then it does order the bars.  However, if I try to pass in an
array, I get the following.  Please note - Im new to Julia so I may
have some misunderstanding about how array substitution works, or have
made a newbie syntax error.  Based on your example though this seemed a
logical substitution.

Thanks!



usingGadfly;

set_default_plot_size(30cm, 18cm)

plot(results,y="count",x="name",

Scale.x_discrete(levels=results["name"]),

Scale.y_continuous(format=:plain),

Scale.discrete_color_manual("#6084b4","#69b461","#8d72b4","#60a6b4","#b460b4","#
eea34b","#cc5266","#cb96d6","#75c7eb","#a1d6bb"),

color="name",

Geom.bar,

Guide.xlabel("Name"), Guide.ylabel("Tests"), Guide.title("Title"),

Theme(panel_fill=color("#ff"), panel_stroke=color("#ff"), grid_color=col
or("#e1e3e5"),

minor_label_color=color("#4e5c67"), bar_spacing=2mm))




no method PooledDataArray{T,R<:Integer,N}(DataArray{UTF8String,1}, DataArray{UTF
8String,1})
 in discretize at /home/ubuntu/.julia/v0.3/Gadfly/src/scale.jl:280
 in apply_scale at /home/ubuntu/.julia/v0.3/Gadfly/src/scale.jl:367
 in apply_scales at /home/ubuntu/.julia/v0.3/Gadfly/src/scale.jl:28
 in apply_scales at /home/ubuntu/.julia/v0.3/Gadfly/src/scale.jl:48
 in render at /home/ubuntu/.julia/v0.3/Gadfly/src/Gadfly.jl:624
 in draw at /home/ubuntu/.julia/v0.3/Gadfly/src/Gadfly.jl:730
 in writemime at /home/ubuntu/.julia/v0.3/Gadfly/src/Gadfly.jl:755
 in sprint at io.jl:460
 in display_dict at /home/ubuntu/.julia/v0.3/IJulia/src/execute_request.jl:27





results["name"]



Out[40]:
10-element DataArray{UTF8String,1}:
 "Name 1"
 "Name 2"


"Name 3"

"Name 4"

"Name 5"

"Name 6"

"Name 7"

"Name 8"

"Name 9"

"Name 10"


On Tuesday, May 20, 2014 7:23:26 PM UTC-7, Daniel Jones wrote:


It should work if you add:

Scale.x_discrete(levels=["a", "b", "c"])

where ["a", "b", "c"] is a vector of the values in the order you'd like
them to appear.



On Tue, May 20, 2014, at 05:32 PM, Dan B wrote:

Friends,

I have a simple array that has counts (sorted descending) and names
associated with each count (please see screenshot).  When I plot a bar
chart with name on the X axis, and count on the Y axis, the bars get
automatically sorted alphabetically by the names on the Y axis.  I
would like to have the bars sorted ascending or descending by the Y
axis (the count), essentially to match the order that I have in the
array.  Am I missing something simple?

Thanks in advance!

- - Dan

  Email had 1 attachment:
  * BarChartOrderingIssue.png
  *   76k (image/png)


Re: [julia-users] Gadfly bar chart sorting / ordering

2014-05-20 Thread Daniel Jones
No problem. :)





On Tue, May 20, 2014, at 08:55 PM, Dan B wrote:

Thanks Daniel!  Works perfectly!  Very much appreciated :)

On Tuesday, May 20, 2014 8:43:55 PM UTC-7, Daniel Jones wrote:

I agree, that should work. I'll try to fix it when I have a chance.

In the mean time, a work around would be to use
levels=collect(xs) where xs is your vector of names. That will
effectively convert the PooledDataArray to a regular Array, so should
work.


On Tue, May 20, 2014, at 08:25 PM, Dan B wrote:

>From one Daniel to the next - thanks! :)  This looks like exactly what
I need.  If I try manually constructing a vector with the names like
you did, then it does order the bars.  However, if I try to pass in an
array, I get the following.  Please note - Im new to Julia so I may
have some misunderstanding about how array substitution works, or have
made a newbie syntax error.  Based on your example though this seemed a
logical substitution.

Thanks!



usingGadfly;

set_default_plot_size(30cm, 18cm)

plot(results,y="count",x="name",

Scale.x_discrete(levels=results["name"]),

Scale.y_continuous(format=:plain),

Scale.discrete_color_manual("#6084b4","#69b461","#8d72b4","#60a6b4","#b460b4","#
eea34b","#cc5266","#cb96d6","#75c7eb","#a1d6bb"),

color="name",

Geom.bar,

Guide.xlabel("Name"), Guide.ylabel("Tests"), Guide.title("Title"),

Theme(panel_fill=color("#ff"), panel_stroke=color("#ff"), grid_color=col
or("#e1e3e5"),

minor_label_color=color("#4e5c67"), bar_spacing=2mm))




no method PooledDataArray{T,R<:Integer,N}(DataArray{UTF8String,1}, DataArray{UTF
8String,1})
 in discretize at /home/ubuntu/.julia/v0.3/Gadfly/src/scale.jl:280
 in apply_scale at /home/ubuntu/.julia/v0.3/Gadfly/src/scale.jl:367
 in apply_scales at /home/ubuntu/.julia/v0.3/Gadfly/src/scale.jl:28
 in apply_scales at /home/ubuntu/.julia/v0.3/Gadfly/src/scale.jl:48
 in render at /home/ubuntu/.julia/v0.3/Gadfly/src/Gadfly.jl:624
 in draw at /home/ubuntu/.julia/v0.3/Gadfly/src/Gadfly.jl:730
 in writemime at /home/ubuntu/.julia/v0.3/Gadfly/src/Gadfly.jl:755
 in sprint at io.jl:460
 in display_dict at /home/ubuntu/.julia/v0.3/IJulia/src/execute_request.jl:27





results["name"]



Out[40]:
10-element DataArray{UTF8String,1}:
 "Name 1"
 "Name 2"


"Name 3"

"Name 4"

"Name 5"

"Name 6"

"Name 7"

"Name 8"

"Name 9"

"Name 10"


On Tuesday, May 20, 2014 7:23:26 PM UTC-7, Daniel Jones wrote:


It should work if you add:

Scale.x_discrete(levels=["a", "b", "c"])

where ["a", "b", "c"] is a vector of the values in the order you'd like
them to appear.



On Tue, May 20, 2014, at 05:32 PM, Dan B wrote:

Friends,

I have a simple array that has counts (sorted descending) and names
associated with each count (please see screenshot).  When I plot a bar
chart with name on the X axis, and count on the Y axis, the bars get
automatically sorted alphabetically by the names on the Y axis.  I
would like to have the bars sorted ascending or descending by the Y
axis (the count), essentially to match the order that I have in the
array.  Am I missing something simple?

Thanks in advance!

- - Dan

  Email had 1 attachment:
  * BarChartOrderingIssue.png
  *   76k (image/png)


Re: [julia-users] Gadfly: plotting histogram of a integer variable x

2014-05-22 Thread Daniel Jones
Hi Paulo,



Try adding Scale.x_continuous to the plot. In your example the
histogram is drawing a bar for every integer, which is why they're so
narrow.





On Wed, May 21, 2014, at 04:06 PM, Paulo Castro wrote:

Hi guys,

I'm having a problem when plotting data like this:
data=int(round(dropna(outcome[:,11])))
p=plot(x=data,Geom.histogram)

Here, data is an Array{Int64,1}. But the plot I get after running
thishave the bars spread, ignoring the space between integers. Is this
expected? How can I make the same plot, but enlarging the bars so they
touch each other?



[1][myplot.png]

References

1. 
https://lh6.googleusercontent.com/-5_gJWTBY4vY/U30w2QEPWyI/AGU/mfgnxTzo8uE/s1600/myplot.png


Re: [julia-users] Re: OT: entering Unicode characters

2014-05-22 Thread Daniel Jones
Also for vim users who aren't aware of this: vim has a convenient way
to enter common special characters in the form of [1]digraphs which you
can enter by pressing ctrl-k in insert mode. You have to learn the
digraph for the symbol, but they are pretty mnemonic in their
assignment (e.g 'C(' -> ⊂, 'm*' -> μ, 's*' -> σ, 'Fm' -> ♀), and
honestly, you wouldn't be using vim if you weren't into maximizing
efficiency by learning short cryptic commands.





On Thu, May 22, 2014, at 12:03 PM, Miguel Bazdresch wrote:

In vim, you can do something like

imap \alpha u03b1

to reproduce this behavior.

-- mb



On Thu, May 22, 2014 at 1:27 PM, Steven G. Johnson
<[2]stevenj@gmail.com> wrote:

A quick update for people who haven't been tracking git closely:

The Julia REPL (#6911), IJulia, and (soon) Emacs julia-mode (#6920) now
allows you to type many mathematical Unicode characters simply by
typing the LaTeX symbol and hitting TAB.

e.g. you can type \alpha and get α, or x\hat and get x̂.

There are currently 736 supported symbols (though not all of them are
valid in Julia identifiers).   This should provide a consistent,
cross-platform Julian idiom for entering Unicode math.

Hopefully this can also be added to other popular editors at some
point, e.g. presumably vim can be programmed to do this, and there is a
somewhat similar mode for Sublime
([3]https://github.com/mvoidex/UnicodeMath).  (Less-programmable
editors might need source-level patches, but it doesn't seem like an
unreasonable patch to suggest.)

References

1. http://vimdoc.sourceforge.net/htmldoc/digraph.html
2. mailto:stevenj@gmail.com
3. https://github.com/mvoidex/UnicodeMath


Re: [julia-users] Experimental package documentation package.

2014-06-08 Thread Daniel Jones


A good way of documenting packages is one of the biggest gaps in the
julia ecosystem right now. Part of the reason why is evinced in the
issues you cite: no matter what the system is, someone is going to hate
it. At this point, I'm sort of hoping someone will just ignore all
feedback and build whatever they want.



That said, I think this is a pretty elegant solution. Just relying on
markdown h1 and h2 headers leaves open the possibility of generating
html documentation from the same source. That's something I appreciate,
since I'd also want to generate html docs with example plots rendered
for gadfly.



With Jake Bolewski's julia parser, I hope it will become easier to
extract documentation from source code, either from comments or
something like docstrings. Have you given any though to that?





On Thu, Jun 5, 2014, at 03:13 PM, Michael Hatherly wrote:

Hi all,



I've just put up a rough prototype for package documentation at
[1]https://github.com/MichaelHatherly/Docile.jl. This is not meant to
be a solution to the documentation problem, but rather to start some
fresh discussion on the matter.



Any feedback would be great. There's more details in the readme.



Regards,

Mike

References

1. https://github.com/MichaelHatherly/Docile.jl


Re: [julia-users] negative power throws error

2014-06-08 Thread Daniel Jones
I'd definitely be in favor of '^' converting to float, like '/', having
[1]fallen for than recently.



On Sat, Jun 7, 2014, at 12:53 AM, Ivar Nesje wrote:

>

> There has also been discussion on whether ^(a::Integer,b::Integer)
should

> return a Float64 by default, and defer to pow() like /(a::Integer,

> b::Integer) defers to div(). The problem is that many people like the

> 10^45 vs 1e45 notation for large integers vs float constants, and we
can

> make it a clean error instead of a silent bug.

References

1. 
https://github.com/JuliaLang/Color.jl/commit/c3d05dd2b94f0d38b64ef86022accdfec886a673


[julia-users] Re: Help on performance issues

2015-10-18 Thread Daniel Jones
Hi Patrick,

The biggest difference here is how `res` and `allres` are updated. In 
python version you say 'res+[pos[0]]' which creates a new list with the 
value appended, but in the Julia version you use `union(copy(res),pos[1])`. 
The union function will hash all the values in res and pos[1] to ensure 
there are no duplicates, so it's considerably slower that what's happening 
in the python or lisp version. If I change those `union` calls to `push!`, 
it's more closely resembles what the python version is doing, and reduces 
the run time to about 0.5 seconds for me.

You could also try using a linked list like the one in the DataStructures 
package to avoid copying `res` whenever you add a value to it, which would 
bring it inline with the lisp version, and could be faster.


On Sunday, October 18, 2015 at 6:49:45 PM UTC-7, Patrick Useldinger wrote:
>
> Hi everybody,
>
> I am currently benchmarking languages to write a kakuro solver in. I am 
> not really familiar with Julia but ported the small algorithm I had written 
> in Lisp and PyPy to Julia nevertheless. Unfortunately Julia's performance 
> is really bad and I'm reaching out to the community to find out whether 
> it's due to my coding or not.
>
> Here's the code in Julia:
>
> function decompose(val, num)
>   function sub(num, tot, res, pos, allres)
> if val==tot && num==0
>   union(allres, res)
> elseif tot0 && !isempty(pos)
>   sub(num-1, tot+pos[1], union(copy(res),pos[1]), pos[2:end], sub(num, 
> tot, res, pos[2:end], allres))
> else
>   allres
> end
>   end
>   sub(num, 0, Int16[], 1:(max(num, 10))-1, Array[])
> end
>
> for i in 1:45
>   for j in 2:20
> res = decompose(i, j)
>   end
> end
>
> It takes roughly 13.4 seconds on my computer.
>
> The equivalent Python code
>
> def decompose(val, num):
> def sub(num, tot, res, pos, allres):
> if tot == val and num == 0:
> return allres+res
> elif tot < val and num != 0 and pos:
> return sub(num-1, tot+pos[0], res+[pos[0]], pos[1:], sub(num, 
> tot, res, pos[1:], allres))
> else:
> return allres
> return sub(num, 0, [], range(1, max(num, 10)), [])
>
>
> if __name__ == "__main__":
> for i in range(1, 46):
> for j in range(2,21):
> res = decompose(i,j)
>   
> is 1.4 seconds and the Lisp
>
> defun decompose (val num)
>   (labels ((sub (num tot res pos allres)
>  (cond
>   ((and (= tot val) (zerop num)) (cons (reverse res) allres))
>   ((and (< tot val) (not (zerop num)) (not (null pos)))
>(sub (1- num) (+ tot (car pos)) (cons (car pos) res) (cdr 
> pos)
> (sub num tot res (cdr pos) allres)))
>   (t allres
> (reverse (sub num 0 nil (loop for i from 1 below (max num 10) collect 
> i) nil
>
> (time
>  (loop for val from 1 below 46  do
>(loop for num from 2 below 21 do
>  (let ((res (decompose val num)))
>
> is 0.5 seconds.
>
> Any hints to make the Julia code perform better?
>
> Regards,
> -Patrick
>


[julia-users] Re: Interest in a Seattle-Area Julia Meetup?

2015-10-19 Thread Daniel Jones
Count me in! I'm happy to present something as well. I know of a few Julia 
users at UW, not all of whom are necessarily on github, so I suspect 
there'd be more than 9 people interested.


On Monday, October 19, 2015 at 12:46:02 PM UTC-7, tim@multiscalehn.com 
wrote:
>
> I work for a company where we are big fans of Julia, and are using it for 
> several projects. We have thrown around the idea of hosting a meetup. We 
> have the space and the resources to put it on, and could provide some good 
> content. I know there are some active Julia devs at the UW but I wanted to 
> put out feelers to see who might be interested in attending, or even 
> better, giving a talk or demo. I guarantee a good time will be had by all.
>
> - Tim
>


Re: [julia-users] Bokeh.jl update released: call for feedback

2015-02-23 Thread Daniel Jones
Ouch, it looks like it does even after code generation. I need to look into 
that. I never noticed because I always use hexbin for these sorts of plots, 
which also could be faster but is still only 2.5 seconds for this example.

On Monday, February 23, 2015 at 10:36:28 AM UTC-8, Stefan Karpinski wrote:
>
> Yes, that 33 seconds for the first Gadfly plot is all code generation – 
> the second time you do it, it certainly doesn't take 33 seconds.
>
> On Mon, Feb 23, 2015 at 1:34 PM, Tim Holy 
> > wrote:
>
>> Do those timings include compilation? It's not really meaningful on the 
>> first
>> run.
>>
>> For reference: on my laptop, Winston (on the second run):
>>
>> julia> @time (p = plot(x,y); display(p))
>> elapsed time: 0.256627468 seconds (16 MB allocated, 1.77% gc time in 1 
>> pauses
>> with 0 full sweep)
>> ""
>>
>> Even this is slow by comparison to where I think we want to be.
>>
>> --Tim
>>
>> On Monday, February 23, 2015 06:27:24 PM Samuel Colvin wrote:
>> > You're probably right about research publications, I guess plots these
>> > don't need to be interactive which makes things easier from a cross
>> > platform perspective.
>> >
>> > Performance wise I'm not sure you're right, with Julia 0.3.6 and latest
>> > packages:
>> >
>> > julia> using Gadfly
>> >
>> > julia> x=1:100
>> > 1:100
>> >
>> > julia> y=sqrt(x);
>> >
>> > julia> @time draw(PNG("test.png", 6inch, 3inch), plot(x=x, y=y))
>> > elapsed time: 33.860814218 seconds (2043746808 bytes allocated, 3.83% gc
>> > time)
>> >
>> > julia> import Bokeh
>> >
>> > julia> Bokeh.autoopen(true)
>> > true
>> >
>> > julia> @time Bokeh.plot(x, y)
>> > elapsed time: 1.557460583 seconds (125617712 bytes allocated)
>> > Plot("Bokeh Plot" with 1 datacolumns)
>> >
>> > Timing on my phone, the Bokeh plot had opened in chrome in 6 seconds. It
>> > was a little slow but still fine to zoom/pan etc.
>> >
>> > One of the nice things about Bokeh is that unlike d3, plotly or Gadfly 
>> it
>> > uses canvas not SVG for it's plots which makes it way faster.
>> >
>> >
>> > --
>> >
>> > Samuel Colvin
>> > s...@muelcolvin.com,
>> > 07801160713
>> >
>> > On 23 February 2015 at 18:00, Stefan Karpinski > > wrote:
>> > > Bokeh and Bokeh.jl are both very cool – thanks so much for all the 
>> work on
>> > > the package!
>> > >
>> > > There seem to still be visualization tasks that have scale and 
>> performance
>> > > requirements such that HTML and JavaScript don't cut it. Web 
>> technologies
>> > > are also generally not up to the task of producing publication-quality
>> > > graphics, e.g. for research publications. The gaps are probably both
>> > > diminishing, but I don't think we're quite there yet.
>> > >
>> > > On Mon, Feb 23, 2015 at 12:38 PM, Samuel Colvin > >
>> > >
>> > > wrote:
>> > >> To coincide (approximately) with the release of Bokeh v0.8.0 I've
>> > >> released a significantly improved version of Bokeh.jl:
>> > >>
>> > >> http://bokeh.github.io/Bokeh.jl/
>> > >>
>> > >> This is the first plotting library I've built and the first proper 
>> Julia
>> > >> package. I would therefore really appreciate any feedback on the 
>> plotting
>> > >> interface and the structure of the package itself.
>> > >>
>> > >> Bokeh.jl is still a bit rough round the edges and missing some basic
>> > >> features, but the examples above demonstrate what it can do.
>> > >>
>> > >> Bokeh  is an interactive 
>> plotting
>> > >> library originally developed for python which uses HTML & Javascript 
>> as
>> > >> it's backend to display and manipulate plots.
>> > >>
>> > >> Whether by using Bokeh or other libraries, web technologies are the
>> > >> obvious option for Julia to get great visualization/graphics/UI 
>> without
>> > >> the
>> > >> pain.
>> > >>
>> > >> I suggest (and I assume I'm about to get shot down) that the Julia
>> > >> community stops messing around with any OS specific graphics code and
>> > >> adopts HTML for all future visualizations. Are there any cases where 
>> that
>> > >> wouldn't work?
>>
>>
>

[julia-users] Re: latex axis labels in Gadfly

2015-02-27 Thread Daniel Jones
There's not currently a way to do latex labels, but you can do superscript 
and subscript with html-style tags. In your example, use "c2".

On Friday, February 27, 2015 at 5:49:10 AM UTC-8, Andrei Berceanu wrote:
>
> I am trying to get rendering of LaTeX expressions in Gadfly axes labels, 
> with
>
>
> *using Gadflyplot(x=1:10, y=rand(10), Geom.line, Geom.point, 
> Guide.xlabel("$c^2$"), Guide.ylabel("E"))*
>
> however this does not seem to work. Does anyone know how to do it?
>
> //A
>


[julia-users] Re: Gadfly legend for different layers

2015-02-27 Thread Daniel Jones
You can manually create a colorkey, using Geom.manual_color_key, it works 
like

Geom.manual_color_key("Key Title", ["Thing One", "Thing Two"], 
[color("red"), color("green")])

On Friday, February 27, 2015 at 5:53:29 AM UTC-8, Andrei Berceanu wrote:
>
> I have a 2D plot of 2 layers with different colors:
>
>
>
>
>
> *using Gadflyplot(layer(x=1:10, y=rand(10), Geom.line, Geom.point, 
> Theme(default_color=color("red"))),   layer(x=1:10, y=rand(10), 
> Geom.line, Geom.point, Theme(default_color=color("green"*How can I 
> generate a legend which specifies what each line color represents? I tried 
> using 
>
> Guide.colorkey but that doesn't seem to work for layers.
>
> //A
>
>

[julia-users] Re: Gadfly legend for different layers

2015-02-27 Thread Daniel Jones
Right, I meant "Guide.manual_color_key". Thanks.

On Friday, February 27, 2015 at 9:20:46 AM UTC-8, cormu...@mac.com wrote:
>
> Guide?
>
> Guide.manual_color_key("Key Title", ["Thing One", "Thing Two"], 
> [color("red"), color("green")]),
>
>

[julia-users] Re: How does Measure work at y-axis in Gadfly.jl?

2015-03-12 Thread Daniel Jones

It can actually actually work both ways: cx and cy give "context units", 
which by default are between 0 and 1, and go from left-to-right and 
top-to-bottom, but can be redefined to be anything.

So, this draws a line from the top-left to the bottom-right.
compose(context(), line([(0cx,0cy), (1cx,1cy)]), stroke("black"))

But I can change the units in the context, it draws a line from the 
bottom-left to top-right.
compose(context(units=UnitBox(0,1,1,-1)), line([(0cx,0cy), (1cx,1cy)]), 
stroke("black"))

UnitBox defines a new coordinate system in which the top-left corner is (0, 
1), and the context is 1 unit wide and 1 unit tall, but the height is given 
as "-1", which somewhat unintuitively flips the orientation of the units.

If you look at the bottom of "coord.jl" in Gadfly, you'll see how the 
coordinate system for the plot gets set up:

context(units=UnitBox(
coord.xflip ? xmax : xmin,
coord.yflip ? ymin : ymax,
coord.xflip ? -width : width,
coord.yflip ? height : -height,
leftpad=xpadding,
rightpad=xpadding,
toppad=ypadding,
bottompad=ypadding),






On Wednesday, March 11, 2015 at 10:33:35 PM UTC-7, nanaya tachibana wrote:
>
> I wanted to contribute to Gadfly.jl and I started from looking into 
> bar.jl. 
> I found that the value cy of Measure in Gadfly.jl increases from bottom to 
> top, but it increases from top to bottom in Compose.jl.
> What makes Measure work in that way? 
>
> I really appreciate any help you can provide.
>
>

[julia-users] Re: How does Measure work at y-axis in Gadfly.jl?

2015-03-12 Thread Daniel Jones

And to expand on the point that context units can be anything: they don't 
even have to be numbers. Here's drawing a horizontal line from today to 
tomorrow.

today = Dates.today()
tomorrow = today + Dates.Day(1)
compose(context(units=UnitBox(today, 0, Dates.Day(1), 1)),
line([(today, 0.5), (tomorrow, 0.5)]), stroke("black"))



On Thursday, March 12, 2015 at 12:14:28 AM UTC-7, Daniel Jones wrote:
>
>
> It can actually actually work both ways: cx and cy give "context units", 
> which by default are between 0 and 1, and go from left-to-right and 
> top-to-bottom, but can be redefined to be anything.
>
> So, this draws a line from the top-left to the bottom-right.
> compose(context(), line([(0cx,0cy), (1cx,1cy)]), stroke("black"))
>
> But I can change the units in the context, it draws a line from the 
> bottom-left to top-right.
> compose(context(units=UnitBox(0,1,1,-1)), line([(0cx,0cy), (1cx,1cy)]), 
> stroke("black"))
>
> UnitBox defines a new coordinate system in which the top-left corner is 
> (0, 1), and the context is 1 unit wide and 1 unit tall, but the height is 
> given as "-1", which somewhat unintuitively flips the orientation of the 
> units.
>
> If you look at the bottom of "coord.jl" in Gadfly, you'll see how the 
> coordinate system for the plot gets set up:
>
> context(units=UnitBox(
> coord.xflip ? xmax : xmin,
> coord.yflip ? ymin : ymax,
> coord.xflip ? -width : width,
> coord.yflip ? height : -height,
> leftpad=xpadding,
> rightpad=xpadding,
> toppad=ypadding,
> bottompad=ypadding),
>
>
>
>
>
>
> On Wednesday, March 11, 2015 at 10:33:35 PM UTC-7, nanaya tachibana wrote:
>>
>> I wanted to contribute to Gadfly.jl and I started from looking into 
>> bar.jl. 
>> I found that the value cy of Measure in Gadfly.jl increases from bottom 
>> to top, but it increases from top to bottom in Compose.jl.
>> What makes Measure work in that way? 
>>
>> I really appreciate any help you can provide.
>>
>>

[julia-users] Re: How does Measure work at y-axis in Gadfly.jl?

2015-03-12 Thread Daniel Jones

No, absolute measures are always left-to-right, top-to-bottom.


On Thursday, March 12, 2015 at 2:13:57 AM UTC-7, nanaya tachibana wrote:
>
> Thank you very much. 
> Can anything affect the orientation of the absolute measurement of 
> Measure? It goes from left-to-right and top-to-bottom, no matter how I set 
> the units in the context.
>
> On Thursday, March 12, 2015 at 3:14:28 PM UTC+8, Daniel Jones wrote:
>>
>>
>> It can actually actually work both ways: cx and cy give "context units", 
>> which by default are between 0 and 1, and go from left-to-right and 
>> top-to-bottom, but can be redefined to be anything.
>>
>> So, this draws a line from the top-left to the bottom-right.
>> compose(context(), line([(0cx,0cy), (1cx,1cy)]), stroke("black"))
>>
>> But I can change the units in the context, it draws a line from the 
>> bottom-left to top-right.
>> compose(context(units=UnitBox(0,1,1,-1)), line([(0cx,0cy), (1cx,1cy)]), 
>> stroke("black"))
>>
>> UnitBox defines a new coordinate system in which the top-left corner is 
>> (0, 1), and the context is 1 unit wide and 1 unit tall, but the height is 
>> given as "-1", which somewhat unintuitively flips the orientation of the 
>> units.
>>
>> If you look at the bottom of "coord.jl" in Gadfly, you'll see how the 
>> coordinate system for the plot gets set up:
>>
>> context(units=UnitBox(
>> coord.xflip ? xmax : xmin,
>> coord.yflip ? ymin : ymax,
>> coord.xflip ? -width : width,
>> coord.yflip ? height : -height,
>> leftpad=xpadding,
>> rightpad=xpadding,
>> toppad=ypadding,
>> bottompad=ypadding),
>>
>>
>>
>>
>>
>>
>> On Wednesday, March 11, 2015 at 10:33:35 PM UTC-7, nanaya tachibana wrote:
>>>
>>> I wanted to contribute to Gadfly.jl and I started from looking into 
>>> bar.jl. 
>>> I found that the value cy of Measure in Gadfly.jl increases from bottom 
>>> to top, but it increases from top to bottom in Compose.jl.
>>> What makes Measure work in that way? 
>>>
>>> I really appreciate any help you can provide.
>>>
>>>

Re: [julia-users] Plotting table of numbers in Gadfly?

2015-03-13 Thread Daniel Jones

I'm working on it: https://github.com/dcjones/Gadfly.jl/issues/563

The desire for a separate plotting semantics is indicative of some 
shortcoming. So I hope we can resolve that, and there won't be a need to 
wrap Gadfly.


On Friday, March 13, 2015 at 8:24:03 PM UTC-7, Sheehan Olver wrote:
>
>
> Hmm… that’s a little bit complicated… I wonder if there would be 
> interest in a wrapper package for Gadfly that makes these things simpler? 
>
>
>
>
> > On 13 Mar 2015, at 3:03 pm, Jiahao Chen > 
> wrote: 
> > 
> > Daniel is the authoritative source, but for such situations I use 
> > layers and manual color schemes like this: 
> > 
> > using Color, Gadfly 
> > 
> > xgrid=0:10:100 
> > data=rand(10,10) 
> > nrows = size(data, 1) 
> > cm = distinguishable_colors(nrows, lchoices=0:50) #lchoices between 50 
> > and 100 are too bright for my taste for plotting lines 
> > plot( 
> >   [layer(x=xgrid, y=data[i, :], Geom.line, 
> > Theme(default_color=cm[i])) for i=1:nrows]..., 
> >   Guide.manual_color_key("row id", ["row $i" for i=1:nrows], cm), 
> >  ) 
> > 
> > Thanks, 
> > 
> > Jiahao Chen 
> > Staff Research Scientist 
> > MIT Computer Science and Artificial Intelligence Laboratory 
> > 
> > 
> > On Thu, Mar 12, 2015 at 11:54 PM, Sheehan Olver  > wrote: 
> >> 
> >> I have a table of numbers that I want to line plot in Gadfly: i.e., 
> each 
> >> column corresponds to values of a function.  Is this possible without 
> >> creating a DataFrame? 
> >> 
> >> 
>
>

[julia-users] Re: Why is Gadfly so slow when plotting it's first plot?

2015-03-29 Thread Daniel Jones
Shhh, no one is supposed to know that.

On Sunday, March 29, 2015 at 4:47:46 AM UTC-7, Sheehan Olver wrote:
>
> I think it's purposely slow, just to annoy Julia developers into 
> implementing a system that saves compiles from previous sessions 😀
>
> On Sunday, March 29, 2015 at 12:00:28 AM UTC+11, Steven Sagaert wrote:
>>
>> Hi,
>> I use Gadfly to create simple barplots &  save them as SVG. Since this is 
>> for usage in a web page, I've only installed Gadfly, not extra backends. 
>> Now when doing the first plot it is incredibly slow but much better on 
>> subsequent plots. Why is that? Is there anything that can be done to speed 
>> things up?
>>
>

[julia-users] Re: Bioinformatics in Julia

2015-04-25 Thread Daniel Jones
Don't let the lack of activity on the mailing list fool you, it is being 
actively developed. We just mostly communicate in github issues and on 
gitter. Browsing the pending PRs in Bio.jl is a good way to get a sense of 
what's happening: https://github.com/BioJulia/Bio.jl/pulls

On Saturday, April 25, 2015 at 10:08:16 AM UTC-7, Tim K wrote:
>
> Dear All, 
>
> I am finishing a bioengineering postdoc soon, and am looking to learn some 
> bioinformatics. Accordingly, I was wondering what the status of 
> bioinformatics tools for Julia is?
>
>
> (I would post in the biojulia-dev group, but it has not been updated since 
> July 2014.)
>
>
> Cheers,
>
> Tim.
>
>

[julia-users] Re: Bioinformatics in Julia

2015-04-25 Thread Daniel Jones

It wouldn't recommend it for real work just yet. There's a lot of 
functionality yet to be built, or not yet merged, so it can't compete with 
python or matlab in terms of completeness and stability. I'm pretty happy 
with how it's coming along though, so hopefully that will change in the 
future.


On Saturday, April 25, 2015 at 11:36:19 AM UTC-7, Tim K wrote:
>
> Thanks guys.
>
> Would you say that it's suitable for a newbie, or should I stick with 
> MATLAB or python?
>
>
>
> On Saturday, 25 April 2015 20:12:08 UTC+2, Daniel Jones wrote:
>>
>> Don't let the lack of activity on the mailing list fool you, it is being 
>> actively developed. We just mostly communicate in github issues and on 
>> gitter. Browsing the pending PRs in Bio.jl is a good way to get a sense of 
>> what's happening: https://github.com/BioJulia/Bio.jl/pulls
>>
>> On Saturday, April 25, 2015 at 10:08:16 AM UTC-7, Tim K wrote:
>>>
>>> Dear All, 
>>>
>>> I am finishing a bioengineering postdoc soon, and am looking to learn 
>>> some bioinformatics. Accordingly, I was wondering what the status of 
>>> bioinformatics tools for Julia is?
>>>
>>>
>>> (I would post in the biojulia-dev group, but it has not been updated 
>>> since July 2014.)
>>>
>>>
>>> Cheers,
>>>
>>> Tim.
>>>
>>>

[julia-users] Re: Compose.jl: How to draw shapes(circles) from an array in different colors?

2015-05-11 Thread Daniel Jones

You almost have it. What should work is the following:

circles = circle([717.0, 387.0, 737.0], [469.0, 265.0, 25.0], [100.0])
fills = fill(["bisque", "red", "green"])

The subtle difference is to use vectorized circle/fill instead of a vector 
of circles and fills.

The idea is that vectorized properties (like fill) distribute over 
vectorized forms (like circle). What Rene suggests, putting each circle and 
fill in its own context, also works but is a little more work.

Here's some central semantics that I think your missing (which is not your 
fault, compose is poorly documented): 

   1. Forms and properties in Compose are always vectorized. So that 
   fill("bisque") is just shorthand for fill(["bisque"])
   2. There can only be only property of each type in a context. So if you 
   say compose(ctx, fill("bisque"), fill("red")), red clobbers bisque.
   3. Vectors in vectorized forms/properties are cycled, which is why I can 
   write [100.0] instead of [100.0, 100.0, 100.0] in circle, and if I use 
   fill("red") all the circles will be red.
   4. Like I mentioned, vectorized properties distribute over vectorized 
   forms, but the property must either be the same length as the form, or be 
   of length 1.



On Monday, May 11, 2015 at 5:12:40 AM UTC-7, Peter Kristan wrote:
>
>
> compose(context(),
> circle([0.25, 0.5, 0.75], [0.25, 0.5, 0.75], [0.1]),
> fill([LCHab(92, 10, 77), LCHab(68, 74, 192), LCHab(78, 84, 29)]))
>
> This code draws 3 circles in their respective colors defined in fill()
>
> The code bellow is what I tried, but all the circles turned out green. How 
> would I make it so that that first circle would be bisque, the second red, 
> and the third green?
>
> circles = [circle(717.0,469.0,100.0),circle(387.0,265.0,100.0),circle(
> 737.0,25.0,100.0)]
> fills = [fill("bisque"), fill("red"), fill("green")]
>
> composition = compose(context(units=UnitBox(0,0,1000,1000)),
> circles...,
> fills...
> )
>
> Something like this, only from arrays:
> compose(context(),
> circle([0.25, 0.5, 0.75], [0.25, 0.5, 0.75], [0.1]),
> fill([LCHab(92, 10, 77), LCHab(68, 74, 192), LCHab(78, 84, 29)]))
>
>
> Thanks!
>


Re: [julia-users] Best way to plot data to a map?

2014-06-20 Thread Daniel Jones

There's not support for maps yet. But if someone wanted to develop a
package for handling geographical data, I'd be keen to make it
plot-able. I've not worked with this sort of data before, but I'm
guessing the main things we'd need are map projections and a database of
borders of countries, provinces, states, etc.

On Fri, Jun 20, 2014, at 07:31 AM, Tim Holy wrote:
> Gadfly has a d3 backend. But others will have to comment about whether it
> can 
> handle the mapping part.
> 
> --Tim
> 
> On Friday, June 20, 2014 06:43:25 AM Mikayla Thompson wrote:
> > Hi everyone,
> > 
> > I'm new to Julia and trying it out for some data analysis projects with
> > twitter data.
> > 
> > In particular, I'd like to plot tweets to a map, using a different
> > color/icon for various categories of tweet.  It'd also be useful to color
> > various regions.
> > 
> > Something similar to or wrapping d3.js would be perfect. I don't *need* the
> > animation/interactive features, but they'd be useful if available. So far,
> > I haven't been able to find any Julia packages that might work for
> > something like this. Am I just overlooking it, or is there no such
> > functionality at this point?
> > 
> > I'm aware that there is the matplotlib route.  I haven't had much luck in
> > python with mapping using matplotlib, so I'm eager for an alternative.
> > However, is that the most practical choice at this point?
> > 
> > Thanks!
> > --Mikayla
> 


[julia-users] Incoming Gadfly changes

2014-06-20 Thread Daniel Jones
I've just merged branches in Gadfly and Compose that I've been working on 
for a while, and I'm going to tag a new version relatively soon.

For the most part things should work as before. But if you are explicitly 
using the D3 backend or Compose, then I'm about to break your code. Sorry.

Here's a brief explanation of the changes: 
http://nbviewer.ipython.org/gist/dcjones/4d3088d74db6a83b12d3

If you run into problems after the update, please let me know. I realize 
I've been a little inattentive to issues lately, but with this out of the 
way, I'm going to focus on working through those.


[julia-users] Re: Regular expressiosn speed

2014-06-21 Thread Daniel Jones
What version of julia are you using here? I made some improvements to regex 
speed a few weeks ago. I think it's still slightly slower than python, but 
it shouldn't be this slow.

On Saturday, June 21, 2014 4:12:55 PM UTC-7, Matías Guzmán Naranjo wrote:
>
> Is it just my impression or Python's regular expressions are much faster 
> than julia's?
>
> In my machine:
>
> Python 2:
>
> %timeit a = re.sub(r"[,\.;:'\"!¡?¿_\n/\t\(\)\{\}\[\]\- ]", " 1 loops, best of 3: 302 ms per loop
>
> Julia
> @time a = replace(f, r"[,\.;:'\"!¡?¿_\n/\t\(\)\{\}\[\]\- ]", " elapsed time: 5.151800487 seconds (1169203300 bytes allocated)
>
> With a corpus of about one million words
>
> This is pretty bad. Is there any way to improve it?
>


Re: [julia-users] Re: Regular expressiosn speed

2014-06-21 Thread Daniel Jones

Ok, then the good news is that regex is already a lot faster, but the bad 
news is that you have to wait until 0.3 is released or use a prerelease 
build.


On Saturday, June 21, 2014 4:31:03 PM UTC-7, Matías Guzmán Naranjo wrote:
>
> The one in the ubuntu repositories: "Version 0.2.1 (2014-02-11 06:30 UTC)"
>
>
> 2014-06-22 1:24 GMT+02:00 Daniel Jones >
> :
>
>> What version of julia are you using here? I made some improvements to 
>> regex speed a few weeks ago. I think it's still slightly slower than 
>> python, but it shouldn't be this slow.
>>
>>
>> On Saturday, June 21, 2014 4:12:55 PM UTC-7, Matías Guzmán Naranjo wrote:
>>>
>>> Is it just my impression or Python's regular expressions are much faster 
>>> than julia's?
>>>
>>> In my machine:
>>>
>>> Python 2:
>>>
>>> %timeit a = re.sub(r"[,\.;:'\"!¡?¿_\n/\t\(\)\{\}\[\]\- ]", ">> 1 loops, best of 3: 302 ms per loop
>>>
>>> Julia
>>> @time a = replace(f, r"[,\.;:'\"!¡?¿_\n/\t\(\)\{\}\[\]\- ]", ">> elapsed time: 5.151800487 seconds (1169203300 bytes allocated)
>>>
>>> With a corpus of about one million words
>>>
>>> This is pretty bad. Is there any way to improve it?
>>>
>>
>

[julia-users] Re: Incoming Gadfly changes

2014-06-21 Thread Daniel Jones


> Second, sorry for the little OT but, I notice IJulia output key not 
> found: "user_variables"  in the first cell.


I've been getting that intermittently. I'll see if I can reproduce it and 
file a ijulia issue.

Are the plots in this notebook supposed to have the interactivity features?


They were, but I had a bug in my javascript. They should work on firefox 
and safari now.

There are still an issue with using ijulia interactively from safari that I 
haven't figured out how to work around though.

Looks like impressive stuff, Daniel. 


Thanks Tim! 


On Saturday, June 21, 2014 10:45:39 AM UTC-7, Cristóvão Duarte Sousa wrote:
>
> First, thanks for your very nice work.
>
> Second, sorry for the little OT but, I notice IJulia output key not 
> found: "user_variables"  in the first cell. I also get that but I thought 
> it was a problem with my system. Is anyone else also getting that?
>
>
>
> On Friday, June 20, 2014 11:24:14 PM UTC+1, Daniel Jones wrote:
>>
>> I've just merged branches in Gadfly and Compose that I've been working on 
>> for a while, and I'm going to tag a new version relatively soon.
>>
>> For the most part things should work as before. But if you are explicitly 
>> using the D3 backend or Compose, then I'm about to break your code. Sorry.
>>
>> Here's a brief explanation of the changes: 
>> http://nbviewer.ipython.org/gist/dcjones/4d3088d74db6a83b12d3
>>
>> If you run into problems after the update, please let me know. I realize 
>> I've been a little inattentive to issues lately, but with this out of the 
>> way, I'm going to focus on working through those.
>>
>

[julia-users] Re: Incoming Gadfly changes

2014-06-23 Thread Daniel Jones

Sorry to break Jewel support. I did a little digging in MDN.  Here 
<https://developer.mozilla.org/en-US/docs/Web/API/HTMLScriptElement> it 
says that the text field is a concatenation of contents of all the child 
text nodes. Now, text elements have a field wholeText 
<https://developer.mozilla.org/en-US/docs/Web/API/Text.wholeText> which 
gives the concatenation of all the text node siblings. So I'm thinking it 
should be equivalent, and standards-compliant to to do:

script.childNodes.length > 0 ? script.childNodes[0].wholeText : ""

And that should work for HTMLScriptElement and SVGScriptElement. Also, if 
it turns out not to be practical to eval the SVGScriptElement nodes, it 
should be completely possible to move the script tags out of the SVG.

I would like to have a custom theme for plots when displaying on 
LightTable, to make them jive better with a dark background. I'm guessing 
that would I would have to import Jewel and define a special display method?


On Monday, June 23, 2014 9:02:05 AM UTC-7, Mike Innes wrote:
>
> Turns out that I can't eval the Gadfly scripts because they are now inside 
> SVGScriptElement blocks (as opposed to HTMLScriptElement), which don't have 
> a .text property. Any javascript wizards around who know of a way around 
> this?
>
> On Monday, 23 June 2014 09:45:43 UTC+1, Mike Innes wrote:
>>
>> This looks great. Unfortunately it did break the interactivity on Light 
>> Table as predicted, but hopefully that'll be easy to fix. But the plots now 
>> display properly even without JS, which is nice.
>>
>> One issue is that plots don't show up well against dark backgrounds – you 
>> might want to consider adding a white background to them. If not I can 
>> always add in some custom CSS though.
>>
>> On Friday, 20 June 2014 23:24:14 UTC+1, Daniel Jones wrote:
>>>
>>> I've just merged branches in Gadfly and Compose that I've been working 
>>> on for a while, and I'm going to tag a new version relatively soon.
>>>
>>> For the most part things should work as before. But if you are 
>>> explicitly using the D3 backend or Compose, then I'm about to break your 
>>> code. Sorry.
>>>
>>> Here's a brief explanation of the changes: 
>>> http://nbviewer.ipython.org/gist/dcjones/4d3088d74db6a83b12d3
>>>
>>> If you run into problems after the update, please let me know. I realize 
>>> I've been a little inattentive to issues lately, but with this out of the 
>>> way, I'm going to focus on working through those.
>>>
>>

[julia-users] Re: Getting Gadfly results in IJulia to be interactive

2014-07-14 Thread Daniel Jones

What browser are you using?

On Monday, July 14, 2014 11:02:25 AM UTC-7, Darwin Darakananda wrote:
>
> My Gadfly plots seem to be static when they are made in an IJulia 
> notebook.  However, interactive panning and zooming work when I export the 
> IJulia notebook to HTML as well as when I call the plot function from the 
> REPL.  Does anyone else have this problem or have an idea of what's 
> happening?
>
> Thanks,
>
> Darwin
>


[julia-users] Re: Getting Gadfly results in IJulia to be interactive

2014-07-14 Thread Daniel Jones
Yeah, that's an unfortunate Safari issue I haven't figured how to work 
around yet.

On Monday, July 14, 2014 11:48:05 AM UTC-7, Darwin Darakananda wrote:
>
> I see. I've been using Safari.  Just tried it on Firefox and Chrome, it 
> works great.  Thanks!
>
> On Monday, July 14, 2014 11:34:33 AM UTC-7, Daniel Jones wrote:
>>
>>
>> What browser are you using?
>>
>> On Monday, July 14, 2014 11:02:25 AM UTC-7, Darwin Darakananda wrote:
>>>
>>> My Gadfly plots seem to be static when they are made in an IJulia 
>>> notebook.  However, interactive panning and zooming work when I export the 
>>> IJulia notebook to HTML as well as when I call the plot function from the 
>>> REPL.  Does anyone else have this problem or have an idea of what's 
>>> happening?
>>>
>>> Thanks,
>>>
>>> Darwin
>>>
>>

Re: [julia-users] Re: [Gadfly] How do I put layers inside a facet/subplot?

2014-07-25 Thread Daniel Jones

I think this will do the trick, if I understand what you're going for.

 
plot(t,layer(Geom.subplot_grid(Geom.point),ygroup=:_type,x=:rank,y=:thing1,color=:_type),

layer(Geom.subplot_grid(Geom.point),ygroup=:_type,x=:rank,y=:thing2,color=:_type),
Scale.discrete_color_manual("red", "green", "blue"))


On Friday, July 25, 2014 10:51:14 AM UTC-7, Leah Hanson wrote:
>
> Thank, that's very helpful. :)
>
> This is what worked:
> ~~~
>
> plot(t,layer(Geom.subplot_grid(Geom.point),ygroup=:_type,x=:rank,y=:thing1,color=:_type),
>   
> layer(Geom.subplot_grid(Geom.point),ygroup=:_type,x=:rank,y=:thing2,color=:_type))
> ~~~
>
> However, now I'd like to color by layer instead of by :_type, since I want 
> the two layers of dots to be different colors.
>
> This does not work:
> ~~~
>
> plot(t,layer(Geom.subplot_grid(Geom.point),ygroup=:_type,x=:rank,y=:thing1,color="red"),
>   
> layer(Geom.subplot_grid(Geom.point),ygroup=:_type,x=:rank,y=:thing2,color="blue"))
> ~~~
>
> I've also tried passing the color argument into Geom.point or 
> Geom.subplot_grid. I tried setting the value of color to be a 
> "Scale.discrete_color_manual", but the color aesthetic did not consider 
> that to be an appropriate type.
>
> How do assign per-layer colors?
>
> Thanks,
> Leah
>
>
> On Fri, Jul 25, 2014 at 12:34 PM, Johan Sigfrids  > wrote:
>
>> I think you might have to put the Geom.subplot_grid inside the layers.
>>
>>
>> On Friday, July 25, 2014 7:37:48 PM UTC+3, Leah Hanson wrote:
>>>
>>> I am trying to make a relatively complicated graph in Gadfly, and am 
>>> struggling.
>>>
>>> This is some sample data with the same structure as my data.
>>> ~~~
>>> julia> t = readtable("testdata.csv")
>>> 9x5 DataFrame
>>> |---|-|--|---|||
>>> | Row # | _type   | rank | speed | thing1 | thing2 |
>>> | 1 | "red"   | 1| 10.0  | 0.0| 0.0|
>>> | 2 | "red"   | 2| 11.1  | 0.1| 0.2|
>>> | 3 | "red"   | 3| 12.4  | 0.3| 0.0|
>>> | 4 | "green" | 1| 8.0   | 0.2| 1.0|
>>> | 5 | "green" | 2| 7.0   | 0.1| 0.5|
>>> | 6 | "green" | 3| 9.0   | 0.2| 0.0|
>>> | 7 | "blue"  | 1| 1.0   | 1.0| 1.0|
>>> | 8 | "blue"  | 2| 2.0   | 0.2| 0.2|
>>> | 9 | "blue"  | 3| 3.0   | 0.1| 0.1|
>>> ~~~
>>>
>>> Currently, I am trying to make a plot with three rows; each row has a 
>>> plot with two layers. The rows are by :_type. The x-axis for everything is 
>>> :rank. The two layers should be scatterplots of :thing1 and :thing2.
>>>
>>> I have tried several variations, here is one of them:
>>> ~~~
>>> julia> plot(t,Geom.subplot_grid(Geom.point),ygroup=:_type,layer(x=:
>>> rank,y=:thing1),layer(x=:rank,y=:thing2))
>>> Error showing value of type Plot:
>>> ERROR: The following aesthetics are required by Geom.point but are not 
>>> defined: x, y
>>>
>>>  in error at error.jl:21
>>>  in assert_aesthetics_defined at /usr/local/google/home/
>>> lhanson/.julia/v0.3/Gadfly/src/aesthetics.jl:148
>>>  in render at /usr/local/google/home/lhanson/.julia/v0.3/Gadfly/
>>> src/geom/point.jl:27
>>>  in render_prepared at /usr/local/google/home/
>>> lhanson/.julia/v0.3/Gadfly/src/Gadfly.jl:718
>>>  in render at /usr/local/google/home/lhanson/.julia/v0.3/Gadfly/
>>> src/geom/subplot.jl:234
>>>  in render_prepared at /usr/local/google/home/
>>> lhanson/.julia/v0.3/Gadfly/src/Gadfly.jl:718
>>>  in render at /usr/local/google/home/lhanson/.julia/v0.3/Gadfly/
>>> src/Gadfly.jl:673
>>>  in display at /usr/local/google/home/lhanson/.julia/v0.3/Gadfly/
>>> src/Gadfly.jl:922
>>>  in display at /usr/local/google/home/lhanson/.julia/v0.3/Gadfly/
>>> src/Gadfly.jl:837
>>>  in print_response at REPL.jl:140
>>>  in print_response at REPL.jl:125
>>>  in anonymous at REPL.jl:584
>>>  in run_interface at ./LineEdit.jl:1377
>>>  in run_frontend at ./REPL.jl:816
>>>  in run_repl at ./REPL.jl:170
>>>  in _start at ./client.jl:399
>>> ~~~
>>>
>>> How do I put layers inside a subplot?
>>>
>>> Thanks,
>>> Leah
>>>
>>
>

Re: [julia-users] Re: [Gadfly] How do I put layers inside a facet/subplot?

2014-07-25 Thread Daniel Jones
Oh, I see. I think the easiest way would be to rearrange the data with the 
melt function.


melt(t, [:_type, :rank, :speed]) makes a table like:

|---|--|---|-|--|---|
| Row # | variable | value | _type   | rank | speed |
| 1 | thing1   | 0.0   | "red"   | 1| 10.0  |
| 2 | thing1   | 0.1   | "red"   | 2| 11.1  |
| 3 | thing1   | 0.3   | "red"   | 3| 12.4  |
| 4 | thing1   | 0.2   | "green" | 1| 8.0   |
| 5 | thing1   | 0.1   | "green" | 2| 7.0   |
| 6 | thing1   | 0.2   | "green" | 3| 9.0   |
| 7 | thing1   | 1.0   | "blue"  | 1| 1.0   |
| 8 | thing1   | 0.2   | "blue"  | 2| 2.0   |
| 9 | thing1   | 0.1   | "blue"  | 3| 3.0   |
| 10| thing2   | 0.0   | "red"   | 1| 10.0  |
| 11| thing2   | 0.2   | "red"   | 2| 11.1  |
| 12| thing2   | 0.0   | "red"   | 3| 12.4  |
| 13| thing2   | 1.0   | "green" | 1| 8.0   |
| 14| thing2   | 0.5   | "green" | 2| 7.0   |
| 15| thing2   | 0.0   | "green" | 3| 9.0   |
| 16| thing2   | 1.0   | "blue"  | 1| 1.0   |
| 17| thing2   | 0.2   | "blue"  | 2| 2.0   |
| 18| thing2   | 0.1   | "blue"  | 3| 3.0   |

With which the plot can be simplified to:

plot(melt(t, [:_type, :rank, :speed]),
 ygroup=:_type, x=:rank, y=:value, color=:variable,
 Geom.subplot_grid(Geom.point),
 Scale.discrete_color_manual("purple", "orange"))



On Friday, July 25, 2014 12:05:02 PM UTC-7, Leah Hanson wrote:
>
> That's not quite it. I think the :_type values being color names is 
> confusing things. I don't want the dots to be colored by :_type.
>
> I would like dots for :thing1 to be in purple and the dots for :thing2 to 
> be in orange. So every dot in the first layer needs to be purple and every 
> data in the second layer needs to be orange.
>
> Thanks,
> Leah
>
>
> On Fri, Jul 25, 2014 at 1:36 PM, Daniel Jones  > wrote:
>
>>
>> I think this will do the trick, if I understand what you're going for.
>>
>>
>>  
>> plot(t,layer(Geom.subplot_grid(Geom.point),ygroup=:_type,x=:rank,y=:thing1,color=:_type),
>> 
>> layer(Geom.subplot_grid(Geom.point),ygroup=:_type,x=:rank,y=:thing2,color=:_type),
>> Scale.discrete_color_manual("red", "green", "blue"))
>>
>>
>> On Friday, July 25, 2014 10:51:14 AM UTC-7, Leah Hanson wrote:
>>
>>> Thank, that's very helpful. :)
>>>
>>> This is what worked:
>>> ~~~
>>> plot(t,layer(Geom.subplot_grid(Geom.point),ygroup=:_
>>> type,x=:rank,y=:thing1,color=:_type),
>>>   layer(Geom.subplot_grid(Geom.point),ygroup=:_type,x=:rank,
>>> y=:thing2,color=:_type))
>>> ~~~
>>>
>>> However, now I'd like to color by layer instead of by :_type, since I 
>>> want the two layers of dots to be different colors.
>>>
>>> This does not work:
>>> ~~~
>>> plot(t,layer(Geom.subplot_grid(Geom.point),ygroup=:_
>>> type,x=:rank,y=:thing1,color="red"),
>>>   layer(Geom.subplot_grid(Geom.point),ygroup=:_type,x=:rank,
>>> y=:thing2,color="blue"))
>>> ~~~
>>>
>>> I've also tried passing the color argument into Geom.point or 
>>> Geom.subplot_grid. I tried setting the value of color to be a 
>>> "Scale.discrete_color_manual", but the color aesthetic did not consider 
>>> that to be an appropriate type.
>>>
>>> How do assign per-layer colors?
>>>
>>> Thanks,
>>> Leah
>>>
>>>
>>> On Fri, Jul 25, 2014 at 12:34 PM, Johan Sigfrids  
>>> wrote:
>>>
>>>> I think you might have to put the Geom.subplot_grid inside the layers.
>>>>
>>>>
>>>> On Friday, July 25, 2014 7:37:48 PM UTC+3, Leah Hanson wrote:
>>>>>
>>>>> I am trying to make a relatively complicated graph in Gadfly, and am 
>>>>> struggling.
>>>>>
>>>>> This is some sample data with the same structure as my data.
>>>>> ~~~
>>>>> julia> t = readtable("testdata.csv")
>>>>> 9x5 DataFrame
>>>>> |---|-|--|---|||
>>>>> | Row # | _type   | rank | speed | thing1 | thing2 |
>>>>> | 1 | "red"   | 1| 10.0  | 0.0| 0.0|
>>>>> | 2 

Re: [julia-users] Re: [Gadfly] How do I put layers inside a facet/subplot?

2014-07-25 Thread Daniel Jones

Hmm, tricky one. Maybe something like this:

t_melted = melt(t, [:_type, :rank])
t_melted[:isspeed] = t_melted[:variable] .== :speed

plot(t_melted,
 ygroup=:isspeed, x=:rank, y=:value, color=:variable,
 Geom.subplot_grid(Geom.point, free_y_axis=true),
 Scale.discrete_color_manual("purple", "orange"))



On Friday, July 25, 2014 2:56:43 PM UTC-7, Leah Hanson wrote:
>
> Yay! Thank you. That does make things a lot easier. I think I'm better 
> understanding how to use melt.
>
> However, now there's another plot I want to make. For one :_type, I want 
> to make two subplots (vertically stacked). The top one should have :thing1 
> and :thing2 in different colors; the bottom one should have :speed. (The :x 
> is always :rank.)
>
> I tried melting it, but I'm not sure how to get two variables on one plot 
> and one on the other:
> ~~~
> julia> reds = t[t[:_type] .== "red",:]
> 3x5 DataFrame
> |---|---|--|---|||
> | Row # | _type | rank | speed | thing1 | thing2 |
> | 1 | "red" | 1| 10.0  | 0.0| 0.0|
> | 2 | "red" | 2| 11.1  | 0.1| 0.2|
> | 3 | "red" | 3| 12.4  | 0.3| 0.0|
>
> julia> m_reds = melt(reds,[:_type,:rank],[:speed,:thing1,:thing2])
> 9x4 DataFrame
> |---|--|---|---|--|
> | Row # | variable | value | _type | rank |
> | 1 | speed| 10.0  | "red" | 1|
> | 2 | speed| 11.1  | "red" | 2|
> | 3 | speed| 12.4  | "red" | 3|
> | 4 | thing1   | 0.0   | "red" | 1|
> | 5 | thing1   | 0.1   | "red" | 2|
> | 6 | thing1   | 0.3   | "red" | 3|
> | 7 | thing2   | 0.0   | "red" | 1|
> | 8 | thing2   | 0.2   | "red" | 2|
> | 9 | thing2   | 0.0   | "red" | 3|
>
> julia> plot(m_reds,
> ygroup=:variable, x=:rank, y=:value, color=:variable,
> Geom.subplot_grid(Geom.point))
> ~~~
>
> Another problem is that I want :thing1 and :thing2 to be on one y-scale 
> and :speed to be on a different one. (The x-axis scale is the same for 
> both.) I don't want to set them each separately to a specific scale, just 
> let them each be separately determined automatically.
>
> Thanks for your help,
> Leah
>
>
> On Fri, Jul 25, 2014 at 4:01 PM, Daniel Jones  > wrote:
>
>> Oh, I see. I think the easiest way would be to rearrange the data with 
>> the melt function.
>>
>>
>> melt(t, [:_type, :rank, :speed]) makes a table like:
>>
>> |---|--|---|-|--|---|
>> | Row # | variable | value | _type   | rank | speed |
>> | 1 | thing1   | 0.0   | "red"   | 1| 10.0  |
>> | 2 | thing1   | 0.1   | "red"   | 2| 11.1  |
>> | 3 | thing1   | 0.3   | "red"   | 3| 12.4  |
>> | 4 | thing1   | 0.2   | "green" | 1| 8.0   |
>> | 5 | thing1   | 0.1   | "green" | 2| 7.0   |
>> | 6 | thing1   | 0.2   | "green" | 3| 9.0   |
>> | 7 | thing1   | 1.0   | "blue"  | 1| 1.0   |
>> | 8 | thing1   | 0.2   | "blue"  | 2| 2.0   |
>> | 9 | thing1   | 0.1   | "blue"  | 3| 3.0   |
>> | 10| thing2   | 0.0   | "red"   | 1| 10.0  |
>> | 11| thing2   | 0.2   | "red"   | 2| 11.1  |
>> | 12| thing2   | 0.0   | "red"   | 3| 12.4  |
>> | 13| thing2   | 1.0   | "green" | 1| 8.0   |
>> | 14| thing2   | 0.5   | "green" | 2| 7.0   |
>> | 15| thing2   | 0.0   | "green" | 3| 9.0   |
>> | 16| thing2   | 1.0   | "blue"  | 1| 1.0   |
>> | 17| thing2   | 0.2   | "blue"  | 2| 2.0   |
>> | 18| thing2   | 0.1   | "blue"  | 3| 3.0   |
>>
>> With which the plot can be simplified to:
>>
>> plot(melt(t, [:_type, :rank, :speed]),
>>  ygroup=:_type, x=:rank, y=:value, color=:variable,
>>  Geom.subplot_grid(Geom.point),
>>  Scale.discrete_color_manual("purple", "orange"))
>>
>>
>>
>> On Friday, July 25, 2014 12:05:02 PM UTC-7, Leah Hanson wrote:
>>
>>> That's not quite it. I think the :_type values being color names is 
>>> confusing things. I don't want the dots to be colored by :_type.
>>>
>>> I would like dots for :thing1 to be in purple and the dots for :thing2 
>>> to be in orange. So every dot in

[julia-users] Re: Warning: could not import StatsBase.bandwidth into Stat

2014-07-26 Thread Daniel Jones
The warning is because the kde function moved to a different package. 
Gadfly uses kde to draw density plots, so it complains about it missing. I 
just tagged a new version that should resolve this.

On Saturday, July 26, 2014 4:33:29 PM UTC-7, Ross Boylan wrote:
>
> In julia 0.3 on linux: 
> julia> using Gadfly 
> Warning: could not import StatsBase.bandwidth into Stat 
> Warning: could not import StatsBase.kde into Stat 
>
> Is this anything to be concerned about? 
> What's causing it?  In particular, is the connection with Gadfly 
> accidental? 
>
> Thanks. 
>
> Ross Boylan 
>
> My system shows 
> julia> Pkg.status() 
> 5 required packages: 
>  - Cairo 0.2.15 
>  - Debug 0.0.3 
>  - Gadfly0.3.3 
>  - ProfileView   0.0.3 
>  - StatsBase 0.6.3 
> 31 additional packages: 
>  - ArrayViews0.4.6 
>  - BinDeps   0.2.14 
>  - Cartesian 0.2.2 
>  - Codecs0.1.2 
>  - Color 0.2.10 
>  - Compose   0.3.3 
>  - Contour   0.0.2 
>  - DataArrays0.2.0 
>  - DataFrames0.5.7 
>  - DataStructures0.3.1 
>  - Datetime  0.1.6 
>  - Distance  0.4.0 
>  - Distributions 0.5.4 
>  - GZip  0.2.13 
>  - Hexagons  0.0.2 
>  - ImageView 0.0.21 
>  - Images0.2.47 
>  - ImmutableArrays   0.0.6 
>  - IniFile   0.2.2 
>  - Iterators 0.1.5 
>  - JSON  0.3.7 
>  - Loess 0.0.2 
>  - PDMats0.2.2 
>  - Reexport  0.0.1 
>  - SIUnits   0.0.2 
>  - SortingAlgorithms 0.0.1 
>  - TexExtensions 0.0.1 
>  - Tk0.2.13 
>  - URIParser 0.0.2 
>  - Winston   0.11.2 
>  - Zlib  0.1.7 
>
>
>

Re: [julia-users] Re: [Gadfly] How do I put layers inside a facet/subplot?

2014-07-26 Thread Daniel Jones

Unfortunately there's not an option to manually change those labels, so 
you'll have to change the "true"/"false" to some more informative string. 
There definitely should be an option to relabel those. I'll make a note to 
do that.


On Friday, July 25, 2014 9:19:14 PM UTC-7, Leah Hanson wrote:
>
> Thank you! That makes sense. I can add a new column to group by to put 
> sets of points on the right lines.
>
> So, now the y-axis is "value by isspeed" and "true" and "false". I can 
> change the "value by isspeed" part using Guide.ylabel("New Label"), but I'm 
> not sure how to make "true" and "false" into real labels. Do I need to put 
> strings into that column so that they'd automatically become the label, or 
> is there a way to set that as part of the call to plot?
>
> Thanks! :D
> Leah
>
>
> On Fri, Jul 25, 2014 at 7:03 PM, Daniel Jones  > wrote:
>
>>
>> Hmm, tricky one. Maybe something like this:
>>
>> t_melted = melt(t, [:_type, :rank])
>> t_melted[:isspeed] = t_melted[:variable] .== :speed
>>
>> plot(t_melted,
>>  ygroup=:isspeed, x=:rank, y=:value, color=:variable,
>>  Geom.subplot_grid(Geom.point, free_y_axis=true),
>>  Scale.discrete_color_manual("purple", "orange"))
>>
>>
>>
>> On Friday, July 25, 2014 2:56:43 PM UTC-7, Leah Hanson wrote:
>>
>>> Yay! Thank you. That does make things a lot easier. I think I'm better 
>>> understanding how to use melt.
>>>
>>> However, now there's another plot I want to make. For one :_type, I want 
>>> to make two subplots (vertically stacked). The top one should have :thing1 
>>> and :thing2 in different colors; the bottom one should have :speed. (The :x 
>>> is always :rank.)
>>>
>>> I tried melting it, but I'm not sure how to get two variables on one 
>>> plot and one on the other:
>>> ~~~
>>> julia> reds = t[t[:_type] .== "red",:]
>>> 3x5 DataFrame
>>> |---|---|--|---|||
>>> | Row # | _type | rank | speed | thing1 | thing2 |
>>> | 1 | "red" | 1| 10.0  | 0.0| 0.0|
>>> | 2 | "red" | 2| 11.1  | 0.1| 0.2|
>>> | 3 | "red" | 3| 12.4  | 0.3| 0.0|
>>>
>>> julia> m_reds = melt(reds,[:_type,:rank],[:speed,:thing1,:thing2])
>>> 9x4 DataFrame
>>> |---|--|---|---|--|
>>> | Row # | variable | value | _type | rank |
>>> | 1 | speed| 10.0  | "red" | 1|
>>> | 2 | speed| 11.1  | "red" | 2|
>>> | 3 | speed| 12.4  | "red" | 3|
>>> | 4 | thing1   | 0.0   | "red" | 1|
>>> | 5 | thing1   | 0.1   | "red" | 2|
>>> | 6 | thing1   | 0.3   | "red" | 3|
>>> | 7 | thing2   | 0.0   | "red" | 1|
>>> | 8 | thing2   | 0.2   | "red" | 2|
>>> | 9 | thing2   | 0.0   | "red" | 3|
>>>
>>> julia> plot(m_reds,
>>> ygroup=:variable, x=:rank, y=:value, color=:variable,
>>> Geom.subplot_grid(Geom.point))
>>> ~~~
>>>
>>> Another problem is that I want :thing1 and :thing2 to be on one y-scale 
>>> and :speed to be on a different one. (The x-axis scale is the same for 
>>> both.) I don't want to set them each separately to a specific scale, just 
>>> let them each be separately determined automatically.
>>>
>>> Thanks for your help,
>>> Leah
>>>
>>>
>>> On Fri, Jul 25, 2014 at 4:01 PM, Daniel Jones  
>>> wrote:
>>>
>>>> Oh, I see. I think the easiest way would be to rearrange the data with 
>>>> the melt function.
>>>>
>>>>
>>>> melt(t, [:_type, :rank, :speed]) makes a table like:
>>>>
>>>> |---|--|---|-|--|---|
>>>> | Row # | variable | value | _type   | rank | speed |
>>>> | 1 | thing1   | 0.0   | "red"   | 1| 10.0  |
>>>> | 2 | thing1   | 0.1   | "red"   | 2| 11.1  |
>>>> | 3 | thing1   | 0.3   | "red"   | 3| 12.4  |
>>>> | 4 | thing1   | 0.2   | "green" | 1| 8.0   |
>>>> | 5 | thing1   | 0.1   | "green" | 2| 7.0   |
>>>> | 

Re: [julia-users] Pitching Julia to company. IJulia live slideshow mode?

2014-07-28 Thread Daniel Jones

It's a little hidden, but from the notebook you change the “Cell Toolbar” 
option at the top to “Slideshow”, then you can define slides, etc. To view 
the slideshow run "ipython nbconvert --post serve --to=slides 
SomeNotebook.ipynb".

I've a similar experience as Stefan with this, though. It works alright if 
your slides are static and simple, but it's kind of glitchy overall.


On Monday, July 28, 2014 12:55:57 PM UTC-7, Jay Kickliter wrote:
>
> I'm still curious though, I don't see an option for slide mode in my 
> IJulia interface. Is it something you enable in the config files? I found 
> the following in custom.jl, but don't know what you're supposed to do with 
> it:
>
>  *// to load the metadata ui extension to control slideshow mode / 
> reveal js for nbconvert
>  *$.getScript('/static/js/celltoolbarpresets/slideshow.js');
>
> On Monday, July 28, 2014 1:40:03 PM UTC-6, Stefan Karpinski wrote:
>>
>> My experience has been that the slideshow mode in IJulia is too buggy to 
>> use for live coding. You can definitely use it to make static slides in 
>> which code has already been evaluated, but I like to type code in live and 
>> evaluate it, which did some rather strange things last I tried. I've found 
>> presenting in the normal IJulia mode to be pretty effective. You just 
>> scroll instead of clicking through to the next slide.
>>
>>
>> On Mon, Jul 28, 2014 at 3:33 PM, Jay Kickliter  
>> wrote:
>>
>>> This week I'm giving a presentation on Julia at my company's technology 
>>> review. I'm pretty sure no one here has heard of it. I'd like to do 
>>> something different than powerpoint. Is *live* slideshow mode possible 
>>> with IJulia? Google is failing me, and I don't have much time to get 
>>> prepared (otherwise I'd do more research before posting, sorry).
>>>
>>
>>

[julia-users] Re: 1st test about 10x slower than c++

2014-07-31 Thread Daniel Jones

Here's a version that's 7x faster (and almost 8x if you disable bounds 
checking). The main thing is to avoid indexing into arrays with ranges (as 
in u[i:j]) if you can, since that will allocate and copy a new array each 
time. And also, like Patrick said, globals should usually be declared with 
'const'.

On Thursday, July 31, 2014 8:38:33 AM UTC-7, Neal Becker wrote:
>
> Attached is my 1st attempt at julia, it is a simple FIR filter, which I 
> translated from my c++ version. 
>
> It is benchmarking about 10x slower than python wrapped c++ version. 
>
> Any suggestions?



firmod2.jl
Description: Binary data


Re: [julia-users] Re: Computing colors of molecules with Julia

2014-08-25 Thread Daniel Jones

I looked into xcolor, and the color matching function they implement is 
only a rough approximation (page 55 of the xcolor manual), whereas Color.jl 
actually matches wavelengths to the CIE standard observer measurements. In 
this case, I think Color is more correct. Here's someone else's plot made 
from the CIE data that looks close to the Color.jl one: 
http://en.wikipedia.org/wiki/Luminosity_function#mediaviewer/File:Srgbspectrum.png


On Monday, August 25, 2014 8:43:13 PM UTC-7, Yakir Gagnon wrote:
>
> Oh sorry, I vaguely mentioned it in my first reply. 
> The short answer is:
>
> using Color,Images
> n = 500
> wl1 = 380.
> wl2 = 780.
> wl = linspace(wl1,wl2,n)
> I = Array(Float64,n,n,3)
> for i = 1:n
> xyz = colormatch(wl[i])
> rgb = convert(RGB,xyz)
> for (j,f) in enumerate([:r,:g,:b])
> I[i,:,j] = rgb.(f)
> end
> end
> imwrite(I,"a.png")
>
> This results in the attached image. While I'm sure there's a much better 
> way of getting that done (feel free to show be btw, I'd love to know how to 
> improve), you can immediately see that the blues and reds are too far close 
> to each other and that the UV violet and IR black are overly represented. 
>
> The long answer is that I used pgfplots with Julia to generate that first 
> image. So the pgfplots part is this:
>
> \begin{tikzpicture}
> \draw (0,0) node {\pgfuseshading{mySpectrum}};
> \foreach \x/\xl in {-3/400,-1/500,1/600,3/700}{
> \draw[gray] (\x,-.75) -- (\x,-1.25) node[anchor=north,black] {\xl};
> }
> \node at (0,-2) {Wavelength (nm)};
> \end{tikzpicture}
>
> and the julia part is this:
>
> using Color
>
> n = 50
> wl1 = 380
> wl2 = 780
> width = 8
> wl = linspace(wl1,wl2,n)
>
> d = linspace(0,width,n)
> f = open("spectrum.txt","w")
> write(f,"\\pgfdeclarehorizontalshading{mySpectrum}{2cm}{\n")
> for i = 1:n-1
> xyz = colormatch(wl[i])
> rgb = convert(RGB,xyz)
>
> txt = "\trgb($(d[i])cm)=($(rgb.r),$(rgb.g),$(rgb.b));\n"
> write(f,txt)
> end
> i = n
> xyz = colormatch(wl[i])
> rgb = convert(RGB,xyz)
> txt = "\trgb($(d[i])cm)=($(rgb.r),$(rgb.g),$(rgb.b))}"
> write(f,txt)
> close(f)
>
> xl = [400:100:700]
> nxl = length(xl)
> wli = wl2-wl1
> w = zeros(nxl)
> for i  = 1:nxl
> r = (xl[i]-wl1)/wli
> w[i] = width*r
> end
> w .-= width/2
>
>
>
>
> Yakir Gagnon
> The Queensland Brain Institute (Building #79)
> The University of Queensland
> Brisbane QLD 4072
> Australia
>
> cell +61 (0)424 393 332
> work +61 (0)733 654 089
>  
>
> On Tue, Aug 26, 2014 at 11:43 AM, Steven G. Johnson  > wrote:
>
>>
>>
>> On Monday, August 25, 2014 6:35:43 PM UTC-4, Yakir Gagnon wrote:
>>
>>> I tried the checkout version of Color, and it's the same (see attached), 
>>> i.e. wrong: the blues should be close to the 400 mark and the reds closer 
>>> to the 700. the UV purple and IR "black" should be closer to the ends than 
>>> what we see. Any idea what's going wrong? 
>>>
>>
>> You didn't give any indication of how you made that plot... 
>>
>
>

[julia-users] Re: Julia native lexical scanner and parser ideas

2014-09-06 Thread Daniel Jones

If you're interested, I have a ragel fork  
that 
let's one generate scanners and parsers for regular languages. We've been 
using it to generate parsers as part of the BioJulia project.

It's generally as fast or faster than PCRE and let's you insert arbitrary 
code in the DFA, like the PCRE callout feature but much more flexible.


On Saturday, September 6, 2014 8:35:21 AM UTC-7, Takeshi Kimura wrote:
>
> Hi there,
>
> I'd like to create old Lex/Yacc like lexical scanner and parser (may be 
> LL(1) or LALR(1)) by implementing Julia Module(s).
>
> The goal is too far, but I'd like to start to write lexical scanner at 
> first.
>
> The lexical scanner is related to Regular Expression objects (NFA(Perl 
> compatible), or DFA (not compatible)).
>
> So, I'd like to use PCRE(3) as its use. May be call out facilities will 
> help me a lot.
>
> But call out facilities only handle 256 call-outs, so we need extend call 
> out by sequentially callouts (callout 0x01, callout 0x01 = callout 257, 
> etc.)
>
> Have you any ideas for this type of lexical scanners?
>
> If we can not use PCRE(3), may be the flex(1) internal APIs should be 
> called.
>
>
> Takeshi KIMURA
>


[julia-users] Re: Announcement: JuliaBio SIG

2014-09-19 Thread Daniel Jones

BioJulia is still very much ongoing. There's only a few of us, and we're 
mostly pretty busy grad students, so it's been slow but steady.

It may not be obvious from looking at the Bio.jl repository but we're 
making progress on a few fronts:

   - An improved phylogenetics module 
   
   - Generating parsers for various formats 
   
   - Aggregating test cases across bioinformatics libraries 
   
   - A fancy interval tree data structure 
   
   - Super efficient nucleotide and protein sequences 
   

There's a lot of work left to be done before it becomes very useful, but 
we're trying to take our time and figure out better ways of doing things, 
rather than reimplement BioPerl yet again. I'm pretty excited about how 
it's turning out so far. High level manipulation intervals and genomic 
annotations is something that's yet to be designed or implemented, but it 
will need to be tackled soon, so that's an area that could use more 
attention.

The mailing list is pretty quiet because most of the discussion happens 
either in issues, pull requests, or in our gitter chat room 
. Feel free to stop by.


On Friday, September 19, 2014 1:37:12 PM UTC-7, muraveill wrote:
>
> Hi,
> Are both projects still ongoing ? I see JuliaBio has no public repo. On 
> the other hand BioJulia has had few updates lately. 
> I am interested in participating but what about making a single 
> bioinformatics library ?
> Among others, I have quite a lot of experience with high-throughput 
> sequencing data and manipulation of "track" files (genomic intervals and 
> read densities), having written several thousand lines of Python for it. 
> Let me know.
>
> Also, is any other domain doing operations on intervals (intersection, 
> decomposition into non-overlapping segments, etc.) ? Of course it is easy 
> if everything is loaded in memory and sorted, but I've developed a few 
> interesting techniques to do it from streams due to the files size.
>
> By the way, I am actually really wondering if Julia can be useful here, 
> since most of our work is reading big files as streams while requiring few 
> numerical computations (except trees and sequences alignments, both already 
> well implemented in C and requiring only a few wrappers).
>


[julia-users] Re: Performance improvements double digest problem

2014-09-26 Thread Daniel Jones
Hi Paul,

Have you looked at the performance chapter in the manual? Some of that 
could help: http://julia.readthedocs.org/en/latest/manual/performance-tips/

There are few things you can do to speed this up:

Declare your globals with 'const'. Use sort! instead of sort to avoid 
allocating a new array. 

Lastly, vector operations like what you do in the Energy function allocate 
intermediate arrays which can slow things down. You can automatically 
"devectorize" this with the Devoctorize package, which lets you rewrite 
your Energy function like

function Energy(original, current)
  @devec ans = sum((original - current).^2 ./ original);
  return ans
end

That gives a nearly 4x speed up when combined with the other two changes I 
mentioned.

P.S. You don't need semicolons at the end of lines in Julia. We usually 
only use them if we need to put two statements on the same line.


On Friday, September 26, 2014 10:53:56 AM UTC-7, Paul Lange wrote:
>
> Hey,
>
> I'm currently working on the double digest problem [1] for a homework. I 
> first wrote the program in Matlab, but that became to slow for larger data 
> sets. So I switched to julia in hope of some
> speedup. Indeed by naively converting I get roughly a 5x increase: 
> 0.734531s in Matlab for 10k iterations.
> @time in julia returns the following after some runs: elapsed time: 
> 0.159896259 seconds (27817864 bytes allocated, 20.24% gc time)
>
> However I hope I can squeeze out some more performance and hope you can 
> give me some hints where to look at. The 20 Mbyte allocations seems quite a 
> lot, however I create a small new vector in the Neighbor function every 
> iteration. I was also unable to run the profiler since it keeps crashing 
> julia (julia 0.3.1, Mac).
>
>
> Code can be found here: 
> https://gist.github.com/palango/04599a4d553068189d96
>
> Some words about it:
> We've got two enzymes A and B that can cut DNA. When A is applied to some 
> DNA some fragments are created and their length can be measured. The sorted 
> lengths are stored in a and the same applies for b.
> If the same DNA gets first digested by A and then by B we get more 
> fragements. Their length is stored in c.
> The problem is now to find the correct order of fragments in a and b so 
> that we get the same fragments as in c.
> The program implements a simulated annealing approach. confa and confb 
> store the permutation auf a and b, which are used to calculate the c of the 
> current permutations.
>
> Thanks in advance,
> Paul
>
> [1] https://en.wikipedia.org/wiki/Restriction_map
>


Re: [julia-users] Legend for layers with specified colors in Gadfly

2014-09-29 Thread Daniel Jones

There is a sort of brute-force way of doing this which is potentially 
nicer: Guide.manual_color_key

See: https://github.com/dcjones/Gadfly.jl/issues/344


On Sunday, September 28, 2014 8:37:57 PM UTC-7, Leah Hanson wrote:
>
> It don't know if you'll like it better, but here's another way to get the 
> same effect using Gadfly. The `Scale.discrete_color_manual` controls the 
> colors used by the scale.
>
> ~~~
> using Gadfly, DataFrames
>
> # populate the data in the format from your example
> x1 = [1:10]; y1=[12:21]
> x2 = [1:10]; y2 = [30:-1:21]
>
> # make a 3 column DataFrame (x,y,line); maybe not the best way to make a 
> DataFrame, but it works.
> df = DataFrame(Dict((:x,:y,:line),([x1,x2],[y1,y2],[["Line 1" for 
> i=1:10],["Line 2" for i=1:10]])))
>
> # plot the DataFrame
> plot(df,x=:x,y=:y,color=:line,Scale.discrete_color_manual("red","purple"),Geom.line,Guide.colorkey("Legend
>  
> title"))
> ~~~
>
> -- Leah
>
> On Sun, Sep 28, 2014 at 4:52 PM, Tomas Lycken  > wrote:
>
>> The only way I’ve figured out to have two layers with different-color 
>> lines and a legend is to do something like this:
>>
>> plot(
>> layer(
>> x = x1,
>> y = y1,
>> color = ["Line 1" for i in 1:length(x1)],
>> Geom.path,
>> ),
>> layer(
>> x = x2,
>> y = y2,
>> color = ["Line 2" for i in 1:length(x2)],
>> Geom.path
>> ),
>>
>> Guide.colorkey("Legend title"),
>> )
>>
>> This works in that it gives me a legend with the text I want, but it 
>> doesn’t give me any way to control the color of the lines - I usually do it 
>> with a Theme(default_color=color("red")) or similar, but since I’ve 
>> given each datapoint a color value (which isn’t really a color) that 
>> doesn’t have any effect.
>>
>> Is there any way I can get a layered plot, where each layer has its own 
>> legend entry, and at the same time control the color of the plot elements 
>> in each layer?
>>
>> // T
>> ​
>>
>
>

[julia-users] Re: Gadfly: adding plots to an existing plot

2014-12-31 Thread Daniel Jones

It's not really supported. Adding a "push!" function to add layers to plots 
was proposed (https://github.com/dcjones/Gadfly.jl/issues/332), but I 
haven't done so yet. In fact, adding layers to a plot p will usually work 
with "push!(p.layers, layer(...))", but that's kind of an unofficial 
solution.


On Wednesday, December 31, 2014 12:26:49 AM UTC-8, AVF wrote:
>
> So, if I created a plot in a block of code, and then want to add another 
> array of data to it in another block of code, is that possible? (I.e., I 
> find it inconvenient that I have only one chance to plot all the layers... 
> or did I misunderstand how it works?)
>


[julia-users] Re: Gadfly: adding plots to an existing plot

2014-12-31 Thread Daniel Jones
My mistake, it should work with append! instead of push!.

For your second question, here's one option:
a, b, c, d = [rand(10) for _ in 1:4]

On Wednesday, December 31, 2014 5:58:15 PM UTC-8, AVF wrote:
>
> Sorry, doesn't seem to work:
>
> a = rand(10)
>
> b = rand(10)
>
> c = rand(10)
>
> d = rand(10)
>
>
> p = plot(x=a, y=b)
>
> push!(p.layers, layer(x=c, y=d))
>
> `convert` has no method matching convert(::Type{Layer}, ::Array{Layer,1})
> while loading In[185], in expression starting on line 9
>
>  in push! at array.jl:457
>
>
> As an aside, is there a way to do something like:
>
> [a b c d] = rand(10,4)
>
>  
>
>
> On Wednesday, December 31, 2014 11:01:36 AM UTC-6, Daniel Jones wrote:
>>
>>
>> It's not really supported. Adding a "push!" function to add layers to 
>> plots was proposed (https://github.com/dcjones/Gadfly.jl/issues/332), 
>> but I haven't done so yet. In fact, adding layers to a plot p will usually 
>> work with "push!(p.layers, layer(...))", but that's kind of an unofficial 
>> solution.
>>
>

[julia-users] Re: Adding Compose circles/lines/polygons to Gadfly plots?

2015-01-09 Thread Daniel Jones
Fixed in master now. Thanks for pointing that out.

On Friday, January 9, 2015 at 2:22:46 AM UTC-8, Nils Gudat wrote:
>
> That's a nice feature to know about, but it seems to suffer from the 
> problem that it doesn't scale with the rest of the graph if one uses the 
> zoom functionality (i.e. the circles don't stay in position relative to the 
> graph if you change the display of the graph). 
>


[julia-users] Re: Adding Compose circles/lines/polygons to Gadfly plots?

2015-01-10 Thread Daniel Jones
Kaj,

Guide.annotation was recently added. I haven't tagged a new version since 
its inclusion, so you need to either checkout master (with 
Pkg.checkout("Gadfly")) or wait until I tag 0.3.11.

On Friday, January 9, 2015 at 4:42:38 PM UTC-8, Kaj Wiik wrote:
>
> Julia 0.3.5
> Gadfly 0.3.10
>
> julia> plot(sin, 0, 2pi, Guide.annotation(compose(context(), circle([pi/2, 
> 3*pi/2], [1.0, -1.0], [2mm]), fill(nothing), stroke("orange"
> ERROR: annotation not defined
>
> ??
>
> Kaj
>
>
> On Friday, January 9, 2015 at 6:28:03 AM UTC+2, Sheehan Olver wrote:
>>
>> I came across this which answers my question:
>>
>> http://gadflyjl.org/guide_annotation.html
>>
>> On Wednesday, December 10, 2014 at 8:05:02 AM UTC+11, Sheehan Olver wrote:
>>>
>>>
>>> I want to add, say, a triangle or circle to a Gadfly plot.  The 
>>> following works
>>>
>>> compose(render(plot(x=1:10,y=1:10)),circle(0.5,0.5,0.1))
>>>
>>> But I want the circle to use the same coordinate system as the plot. 
>>>  Any advice?
>>>
>>>
>>>

[julia-users] Re: Plotting-package-independent API

2015-01-22 Thread Daniel Jones

The issue now is that there are several plotting packages, each with 
advantages and disadvantages, forcing users to make a choice often from 
limited information. I'm afraid defining another plotting API in Base, 
rather than simplifying the matter, will just create another choice you'll 
have to evaluate. It pains me to reference xkcd 927 , 
since it's so often over-applied, but it seems applicable here.

Simon's example of defining show functions for vaguely graphical types 
could be useful if it's kept simple, but the more complicated/featureful it 
becomes, the more it will start to exasperate the problem.

On Thursday, January 22, 2015 at 7:42:37 AM UTC-8, David van Leeuwen wrote:
>
> Hello, 
>
> I've just read up on most recent conversations mentioning plotting, after 
> I went through a similar install-and-try-out cycle for the various plotting 
> packages. 
>
> I am busy with a package named ROC  
> (Receiver 
> Operating Characteristic).  It is mostly about decision cost functions and 
> efficiently computing ROC statistics, but there is also some support for 
> making various plots related to the ROC. 
>
> I do not want to decide for a potential user of this package which 
> plotting package she should use.  So it would be nice if there would be an 
> abstract plotting API (I suppose this does not exist yet). 
>
> Supposing that it is possible to make an API that includes some common 
> plotting primitives, and that makes a runtime selection based on 
> `isdefined(plottingpackagename)`, how would you 
>  - overload a function, typically `plot()`, when at module-include time it 
> is not yet known which plotting package the user wants
>  - specify the dependence of this package to any one of the available 
> plotting packages.  
>
> Thoughts?
>
> Thanks, 
>
> ---david
>


[julia-users] Re: Colour blind friendly defaults for plotting?

2015-02-08 Thread Daniel Jones

Thanks for posting this. We made some attempt in Gadfly to account for 
deuteranopia in the colors we chose, but not protanopia. There's clearly 
more work that needs to be done to improve this. Pointing this out is a big 
help: we have functions to try to simulate color blindness, and I regularly 
show plots to my advisor who's deuteranopic, but otherwise it's hard to 
evaluate how well we're doing. If I experiment with this more, I hope you 
can comment on the results.

A major issue with using cubehelix for numerical data is that, since it's 
based on RGB, it's perceptually non-linear. Some intervals appear to 
transition between two colors very rapidly, while other intervals of the 
same size appear to stay the nearly the same color. This is a problematic 
for data visualization as it can emphasize or deemphasize certain ranges. 
For numerical data, I think it's possible to use something in the spirit of 
cubehelix but in colorspace that accounts for human visual non-uniformity.


On Sunday, February 8, 2015 at 6:13:34 AM UTC-8, Job van der Zwan wrote:
>
> This is inspired by this "speed vs LOC" graph from an earlier discussion 
> (dug up by Steve):
> https://groups.google.com/d/msg/julia-users/BYRAeQJuvTw/O7VK7-vp1EEJ
>
> Because of my protanomaly 
> ,
>  
> I cannot distinguish the Lua, Julia or Octave dots in that picture (or C, 
> Python and JavaScript).
>
> The thing about plotting packages is that you have to meet the needs of 
> two audiences for it: those who produce graphs with it, and those who will 
> read the graphs produced by it, which is a bit of different need than 
> creating a script for yourself. This is part of why it is such an 
> overlooked issue: most people who will make a plot are not colour blind 
> themselves.
>
> Which made me think: instead of a colour blind person asking for a colour 
> blind-friendly version of a graph every time (or suffering in silence, 
> because honestly, I feel like I'm whining when I do this), why not give the 
> plotting packages have more colour blind-friendly defaults? That way most 
> of these issues would be resolved without requiring conscious effort by 
> those using the plotting packages. There's ways of doing so without making 
> the "normal vision" people suffer too.
>
> For example, us a form of CubeHelix or similar smartly designed palette as 
> the default palette:
> http://www.ifweassume.com/2013/05/cubehelix-or-how-i-learned-to-love.html
> https://www.mrao.cam.ac.uk/~dag/CUBEHELIX/
>
> Another option would be to use different shapes for different data points, 
> instead of dots for everything.
>
> Both of these options have the advantage that they would reduce issues 
> with printing graphs in black and white too!
>
> Thoughts?
>


[julia-users] Re: Colour blind friendly defaults for plotting?

2015-02-09 Thread Daniel Jones
The Color  package would be a good 
place to open an issue. If improvements are made there, all plotting 
packages should be able to reap the benefits.

On Monday, February 9, 2015 at 2:34:43 PM UTC-8, Job van der Zwan wrote:
>
> BTW, would it make more sense to (re)open an issue on github about this, 
> and if so: where? Because there are multiple plotting packages, right?
>


[julia-users] Re: change size of individual plot in gadfly under IJulia

2015-02-11 Thread Daniel Jones

Hi Andrei,

You can do this using the draw function, like:

draw(SVG(20cm, 10cm), plot(...))


On Wednesday, February 11, 2015 at 3:42:47 PM UTC-8, Andrei Berceanu wrote:
>
> set_default_plot_size changes the default size of all following plots, but 
> how can i set the size of a certain plot individually?
>
> //A
>