Questions tagged [julia-plots]
95 questions
1
vote
0 answers
MethodError in Julia when using scatter! function
coordinate_distance(x,z) = abs.(x .- z)
square1(x) = sum(coordinate_distance(x,z).^2)
using Plots
LB,UB = 0,20 # Defining Lowerboud and Upperbound
plot(square1, LB, UB, legend=false)
scatter!(z, [square1(x) for x in z])
square1-custom…

Pradnk77
- 11
- 2
1
vote
1 answer
Inconsistent MethodError: only exists outside call to plots
This is code that works fine:
function band_limited_interpolation()
h=1
xmax=10
x = -xmax:h:xmax
xx = -xmax-h/20:h/10:xmax+h/20
v = x .== 0
function p(v)
p = zeros(size(xx))
for i in…

cj wyett
- 152
- 6
1
vote
0 answers
Vector type-recipe plotting in Julia
Is there a way to write a plotting type recipe for a type T and then have Julia somehow infer a corresponding recipe for the type Vector{T}?
Simple example, suppose I have a box struct B, and I write a simple type-recipe for plotting it:
using…

mrip
- 14,913
- 4
- 40
- 58
1
vote
1 answer
Plotting the same plot twice as subplots
I want to create a plot with a couple of subplots using Plots.jl. Here's an example:
using Plots
gr()
p = plot(1:10, 1:10)
q = plot(1:10, 10:-1:1)
plot(p, q)
That works exactly as expected! But say I want to use the same plot twice like…

Dan
- 11,370
- 4
- 43
- 68
1
vote
1 answer
Plotting an float array in julia
I have the following code
using Plots
function test()::nothing
A::Array{Float64,1} = rand(Float64,100)
plot(A)
end
Which I run in julia like this
julia> include("main.jl")
test (generic function with 1 method)
julia> test()
ERROR:…

Matthias Beaupère
- 1,731
- 2
- 17
- 44
1
vote
0 answers
Julia pkg> add results in "no known versions" errors for "Flux" and "Plots"
I am using Julia version 1.5.1 on a Win10 operating system. Trying to add Plots and Flux results in the errors listed below:
(@v1.5) pkg> add Plots
Resolving package versions...
ERROR: Unsatisfiable requirements detected for package Contour…

Brumshinger
- 13
- 3
0
votes
1 answer
3D surface plot with provided coordinate with PlotlyJS in Julia
As stated in the question, I would like to plot a function, f(x, y) which is represented in a vector [x, y, f(x, y)]. So clearly the [x, y] is the desired coordinate.
I looked up in their official page and found 3d surface plot can be done as…

Alphaharrius
- 210
- 1
- 9
0
votes
1 answer
Interpret this Julia error message using PGFPlotsX - key error
I am witnessing strange behaviour with Julia 1.8.5 using the latest of Plots PGFPlots(X) packages.
When adding the call pgfplotsx() I am not getting any output. A MWE is
using Plots
plot(rand(20))
gives the desired output but
using…

KeynesCoeFen
- 79
- 7
0
votes
0 answers
Julia Plots xtick and ytick font halign and valign
I am trying to understand the behavior of certain keyword arguments in the default GR backend for the Julia Plots package. Here is a screen shot that explains what is going on:
I have looked at the documentation for the Plots.jl package and I can't…

ITA
- 3,200
- 3
- 18
- 32
0
votes
1 answer
Extracting and re-using subplots in Julia
How can I extract and reuse/combine subplots in Julia? Consider:
pp = plot(0:0.01:2, [sin.(0:0.01:2), cos.(0:0.01:2)], layout=(1,2));
gg = plot(0:0.01:2, [sin.(0:0.01:2).^2, cos.(0:0.01:2).^2], layout=(1,2));
Both pp and gg report length 2 and…

ITA
- 3,200
- 3
- 18
- 32
0
votes
1 answer
Add table inside plot Julia
I have the following bar plot:
using Plots, DataFrames
Plots.bar(["A", "B", "c"],[6,5,3],fillcolor=[:red,:green,:blue], legend = :none)
Output:
I would like to add a simple small table inside to plot in the top right corner. The table should have…

Quinten
- 35,235
- 5
- 20
- 53
0
votes
2 answers
How to interpret xticks when plotting time series in Julia with Plots.jl and TimeSeries.jl
I have the following code:
using Plots
using TimeSeries
apple_ta = readtimearray("apple.csv")
p = plot(apple_ta[:Open])
Plots.xticks(p)
1-element Vector{Tuple{Vector{Float64}, Vector{String}}}:
([735599.0, 736330.0, 737060.0, 737791.0],…

Bex T.
- 1,062
- 1
- 12
- 28
0
votes
0 answers
How to make stack graph become side by side with this dataset in julia language?
I have got this dataset in julia:
julia>import Downloads
julia>using DLMReader, VegaLite, InMemoryDatasets
julia>data=Downloads.download("https://raw.githubusercontent.com/akshdfyehd/salary/main/ds_salaries.csv")…

hahaha
- 183
- 5
0
votes
1 answer
Plotting error data frame to series Julia
I am having trouble plotting in Julia. After uploading an excel file into a data frame and plotting, I the error: 'Cannot Convert Dataframe to series data for plotting'.
For reference the simplest code to trigger error:
using Plots, XLSX,…

jtancp
- 23
- 2
0
votes
1 answer
How to highlight the area between four lines in julia package Plots.jl?
I want to visualize a simple optimization problem.
The problem is:
min 3x + 2y
s.t. -3x + 3y <= 5
2x + 3y >= 9
x, y >= 0
How it is possible to highlight the feasible region in this problem. In other words, I want to highlight the area between
-3x +…

alex_nas
- 37
- 4