Public API
ParallelPlots.parallelplot
— Methodparallelplot(data::DataFrame, _Arguments_)
Arguments
Parameter | Default | Example | Description |
---|---|---|---|
title::String | "" | title="My Title" | The Title of The Figure, |
colormap | :viridis | colormap=:thermal | The Colors of the Lines |
color_feature | nothing | color_feature="weight" | The Color of the Lines will be based on the values of this selected feature. If nothing, the last feature will be used |
feature_labels | nothing | feature_labels=["Weight","Age"] | Add your own Axis labels, just use the exact amount of labes as you have axis |
feature_selection | nothing | feature_selection=["weight","age"] | Select, which features should be Displayed. If color_feature is not in this List, use the last one |
curve | false | curve=true | Show the Lines Curved |
showcolorlegend | nothing | showcolorlegend=true | Show the Color Legend. If parameter not set & color_feature not shown, it will be displayed automaticly |
scale | nothing | scale=[identity, log, log2, log10, sqrt] | Choose, how each Axis should be scaled. |
Examples
julia> using DataFrames
julia> fig, ax, sc = parallelplot(DataFrame(height=160:180,weight=60:80,age=20:40))
FigureAxisPlot()
julia> display(fig)
CairoMakie.Screen{IMAGE}
Using DrWatson with ParallelPlot
julia> using DataFrames, DrWatson, ParallelPlots
julia> function exec_simulation(d::Dict, results)
@unpack launch_angles, initial_velocities = d
max_height = initial_velocities * launch_angles
push!(results, [
initial_velocities,
launch_angles,
max_height,
])
return results
end;
julia> initial_velocities = [40.0, 50.0];
julia> launch_angles = [30.0, 60.0];
julia> allparams = Dict(
"initial_velocities" => initial_velocities,
"launch_angles" => launch_angles,
);
julia> dicts = dict_list(allparams);
julia> results = DataFrame(
initial_velocity=Float64[],
launch_angle=Float64[],
max_height=Float64[],
);
julia> for d in dicts
results = exec_simulation(d, results)
end;
julia> fig = parallelplot(results, curve=true, figure = (size = (1000, 600),));
julia> display(fig);
# If you want to set the size of the plot
julia> parallelplot( DataFrame(height=160:180,weight=60:80,age=20:40), figure = (resolution = (300, 300),) )
# You can update the Graph with Observables as well
julia> df_observable = Observable(DataFrame(height=160:180,weight=60:80,age=20:40))
julia> fig, ax, sc = parallelplot(df_observable)
# If you want to add a Title for the Figure, sure you can!
julia> parallelplot(DataFrame(height=160:180,weight=reverse(60:80),age=20:40),title="My Title")
# If you want to specify the axis labels, make sure to use the same number of labels as you have axis!
julia> parallelplot(DataFrame(height=160:180,weight=reverse(60:80),age=20:40), feature_labels=["Height","Weight","Age"])
# Adjust Color and and Feature
parallelplot(df,
# You choose which axis/feature should be in charge for the coloring
color_feature="weight",
# you can as well select, which Axis should be shown
feature_selection=["height","age","income"],
# and label them as you like
feature_labels=["Height","Age","Income"],
# you can change the ColorMap (https://docs.makie.org/dev/explanations/colors)
colormap=:thermal,
# ...and can choose to display the color legend.
# If this Attribute is not set,
# it will only show the ColorBar, when the color feature is not in the selected feature
show_color_legend = true
)
# Adjust the Axis scale
parallelplot(df,
feature_selection=["height","age","income"],
scale=[log2, identity, log10]
)
Internal API
ParallelPlots.axis_title!
ParallelPlots.calc_factor
ParallelPlots.calc_y_coordinate
ParallelPlots.calculate_color
ParallelPlots.create_scale_list
ParallelPlots.draw_axis
ParallelPlots.draw_lines
ParallelPlots.get_color_col
ParallelPlots.input_data_check
ParallelPlots.interpolate
ParallelPlots.parallelplot
ParallelPlots.show_color_legend!
ParallelPlots.axis_title!
— Methodaxis_title!(
scene,
endpoints::Observable,
title::String;
titlegap = Observable(4.0f0),
)
This Function will create the Axis Label for a Axis
ParallelPlots.calc_factor
— Methodcalc_factor(min::T, max::T, x::T, fun::Function):: Float64 where {T<:Real}
In Linear Axis represenatation, values between 0-1 are linear distributed. Due to the Logarithmfunction, we need to distribute the values with the given log values to match the axis
Input:
- min::T,
- max::T,
- x::T,
- fun::Function –> [identity, log, log2, log10, sqrt]
Output:
- the distribution with the given function beween 0 and 1
ParallelPlots.calc_y_coordinate
— Methodcalc_y_coordinate(parsed_data, limits, height, offset, feature_index :: Number, sample_index :: Number, scale_list) :: Number
This function will return the y position in the scene, depending of the scale if set
Output:
- the y position of the datapoint in the scene
ParallelPlots.calculate_color
— Methodcalculate_color(pp::ParallelPlot, data::DataFrame) :: Tuple{AbstractString, Vector{Real}, Real, Real}
Calculates the Color values for the Lines
Input:
- pp::ParallelPlot
- data::DataFrame
Output:
- colorcol result of `getcolor_col`
- colorvalues The List of Values of the `colorcol`. Needed to calculate the Color for each Line
- colormin The min value of `colorvalues`. To Calculate the ColorRange
- colormax The max value of `colorvalues`. To Calculate the ColorRange
ParallelPlots.create_scale_list
— Methodcreate_scale_list(numberFeatures :: Number, scale_list)
check the length of the given scale Attribute. Throws an Error if the Length does not match the amount of axis/features If scale is not set, identity, so linear will be used for all axis. if the length of the scale attribute does not fit, an assert error will be thrown
Input:
- numberFeatures::Number
- scale_list nothing or Vector e.g. [log2, log10, identity]
Output:
- given scale_list or vector of [identity, identity, ...] with the length of axis/features
Throws
Assertion, if amount of scales in the scale list does not match the amount of axis/features
ParallelPlots.draw_axis
— Methoddraw_axis(
scene,
width::Number,
height::Number,
offset::Number,
limits,
labels,
numberFeatures::Number,
scale_list
)
Draws the Axis/Feature vertical Axis Lines on the given Scene
ParallelPlots.draw_lines
— Methoddraw_lines(
scene,
pp,
data,
width::Number,
height::Number,
offset::Number,
limits,
numberFeatures::Number,
scale_list,
sampleSize::Number,
parsed_data,
color_values,
color_min,
color_max
)
Function to Draw the Lines connecting the Values on each Axis into the Plot
ParallelPlots.get_color_col
— Methodget_color_col(pp::ParallelPlot, data::DataFrame) :: AbstractString
get the name of the Column, on which the Color should be dependent
Input:
- pp::ParallelPlot
- data::DataFrame
Output:
- AbstractString
ParallelPlots.input_data_check
— Methodinput_data_check(data::DataFrame)
checks the Input Data if the size is correct and no missing values are available
Input:
- DataFrame
Output:
- none
Trows
Throws error on wrong DF
ParallelPlots.interpolate
— Methodinterpolate(last_x::Float64, current_x::Float64, last_y::Float64, current_y::Float64, x::Float64)::Float64
Interpolates the Y Value between the given current/last(x/y) point with the given x value.
Input:
- old and New Coordinate (x/y Value)
- current x Value
Output:
- current, interpolated y Value
ParallelPlots.show_color_legend!
— Methodshow_color_legend!(pp) :: Bool
Returns Boolean if the Color Legend/Bar on the right should be shown
Input:
- pp::ParallelPlot
Output:
- boolean if
show_color_legend
from the Arguments is set, return this value. Else show, when colorfeature is not in featureselection