qwt annotations and examples
This commit is contained in:
parent
85b65acbe0
commit
06ab514472
@ -80,7 +80,7 @@ plot(Vector[randn(100),randn(100) * 100]; axis=[:l,:r],ylabel="LEFT",yrightlabel
|
||||
|
||||
### Vectors w/ pluralized args
|
||||
|
||||
Plot multiple series with different numbers of points. Mix arguments that apply to all series (singular... see `marker`) with arguments unique to each series (pluralized... see `colors`).
|
||||
Plot multiple series with different numbers of points. Mix arguments that apply to all series (marker/markersize) with arguments unique to each series (colors).
|
||||
|
||||
```julia
|
||||
plot(Vector[rand(10),rand(20)]; marker=:ellipse,markersize=8,c=[:red,:blue])
|
||||
@ -207,3 +207,15 @@ subplot!(randn(100,3))
|
||||
|
||||

|
||||
|
||||
### Annotations
|
||||
|
||||
Currently only text annotations are supported. Pass in a tuple or vector-of-tuples: (x,y,text). `annotate!(ann)` is shorthand for `plot!(; annotation=ann)`
|
||||
|
||||
```julia
|
||||
y = rand(10)
|
||||
plot(y,ann=(3,y[3],"this is #3"))
|
||||
annotate!([(5,y[5],"this is #5"),(9,y[10],"this is #10")])
|
||||
```
|
||||
|
||||

|
||||
|
||||
|
||||
BIN
img/qwt/qwt_example_20.png
Normal file
BIN
img/qwt/qwt_example_20.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
@ -9,7 +9,7 @@ qwt() = backend(:qwt)
|
||||
# supportedArgs(::QwtPackage) = setdiff(_allArgs, [:xlims, :ylims, :xticks, :yticks])
|
||||
supportedArgs(::QwtPackage) = [
|
||||
:annotation,
|
||||
:args,
|
||||
# :args,
|
||||
:axis,
|
||||
:background_color,
|
||||
:color,
|
||||
@ -17,7 +17,7 @@ supportedArgs(::QwtPackage) = [
|
||||
:foreground_color,
|
||||
:group,
|
||||
:heatmap_c,
|
||||
:kwargs,
|
||||
# :kwargs,
|
||||
:label,
|
||||
:layout,
|
||||
:legend,
|
||||
@ -105,6 +105,21 @@ function updatePlotItems(plt::Plot{QwtPackage}, d::Dict)
|
||||
end
|
||||
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
|
||||
|
||||
function createQwtAnnotation(plt::Plot, x, y, val::AbstractString)
|
||||
marker = Qwt.QWT.QwtPlotMarker()
|
||||
marker[:setValue](x, y)
|
||||
marker[:setLabel](Qwt.QWT.QwtText(val))
|
||||
marker[:attach](plt.o.widget)
|
||||
end
|
||||
|
||||
function addAnnotations{X,Y,V}(plt::Plot{QwtPackage}, anns::AVec{Tuple{X,Y,V}})
|
||||
for ann in anns
|
||||
createQwtAnnotation(plt, ann...)
|
||||
end
|
||||
end
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user