graphs

Module Contents

Classes

class Data(x: list, y: list, x_label='', y_label='', legend='', is_scattered=False, transfo_x=lambda selfData, x: x, transfo_y=lambda selfData, y: y, xlim=None, ylim=None, permutations=None, sort_output=False, color=None, alpha=255, symbol='o', symbolsize=8, fillsymbol=True, outlinesymbol=1.8, linestyle='-', width=2, meta=None)[source]

This class is used to store informations necessary to plot a 2D graph. It has to be combined with a gui to be useful (ex. pyqtgraph)

set_kwargs(kwargs)[source]

Set a kwarg after creation of the class

set_data(x: list, y: list)[source]

Overwrites current datapoints with new set

set_meta(meta)[source]

Set associated ‘Z’ data

get_x()[source]

Get x coordinates of datapoints

get_symbolsize()[source]

Get size of the symbols

symbol_isfilled()[source]

Check if symbols has to be filled or not

get_symbolOutline()[source]

Get color factor of outline of symbols

get_length_data()[source]

Get number of points

get_xlim()[source]

Get x limits of viewbox

get_ylim()[source]

Get y limits of viewbox

get_y()[source]

Get y coordinates of datapoints

get_meta()[source]

Get associated ‘Z’ data

get_color()[source]

Get color of the line, without transformation

get_color_alpha()[source]

Get color of the line. Return r, g, b in 0, 255 scale

get_alpha()[source]

Get opacity

get_width()[source]

Get width of the line

get_number_of_points()[source]

Get number of points

get_plot_data()[source]

Call this method to get the x and y coordinates of the points that have to be displayed. => After transformation, and after permutations.

Returns:x (list), y (list)
get_plot_meta(x, y)[source]

Call this method to get the z coordinates of the points that been displayed. => After transformation, and after permutations.

Returns:z (list)
get_permutations(x=None)[source]

Return the transformation ‘permutation’: xplot[i] = xdata[permutation[i]]

get_invert_permutations()[source]

Return the inverse of permutations: xdata[i] = xplot[revert[i]]

get_dataIndex_from_graphIndex(index_graph_point)[source]

From an index given in graph, recovers the index of the data.

Parameters:index_graph_point – Index in the graph
Returns:index of the data
get_dataIndices_from_graphIndices(index_graph_point_list)[source]

Same as get_dataIndex_from_graphIndex but with a list in entry. Can (?) improve performances for huge dataset.

Parameters:index_graph_point_list – List of Index in the graph
Returns:List of index of the data
get_graphIndex_from_dataIndex(index_data)[source]

From an index given in the data, recovers the index of the graph.

Parameters:index_data – Index in the data
Returns:index of the graph
get_graphIndices_from_dataIndices(index_data_list)[source]

Same as get_graphIndex_from_dataIndex but with a list in entry. Can (?) improve performances for huge dataset.

Parameters:index_data_list – List of Index in the data
Returns:List of index of the graph
set_permutations(permutations)[source]

Set permutations between datapoints of the trace

Parameters:permutations – list of indices to plot (example: [0, 2, 1] means that the first point will be plotted, then the third, then the second one)
get_x_label()[source]

Get x label of the trace

get_y_label()[source]

Get y label of the trace

get_legend()[source]

Get name of the trace

get_symbol()[source]

Get symbol

add_point(x, y)[source]

Add point(s) to trace (inputs can be list or numeral)

delete_point(index_point)[source]

Delete a point from the datapoints

isScattered()[source]

Check if plot is scatteded

set_indices_points_to_plot(indices)[source]

Set indices points to plot

get_indices_points_to_plot()[source]

Get indices points to plot

get_linestyle()[source]

Get linestyle

__str__()[source]

Return str(self).

export_str()[source]

Method to save the points constituting the trace

set_color(theColor)[source]

Set trace color

set_legend(theLegend)[source]

Set legend

class Graph[source]

Simple graph container that contains several traces

add_trace(data)[source]

Add a trace to the graph

Parameters:dataData
Returns:id of the created trace
remove_trace(idTrace)[source]

Delete a trace from the graph

Parameters:idTrace – id of the trace to delete
get_trace(idTrace) → Data[source]

Get data object of idTrace

Parameters:idTrace – id of the trace to get
Returns:Data
get_all_traces()[source]

Get all the traces id of the graph

get_all_traces_ids()[source]

Get all the traces id of the graph :return: list of id graphs

export_str()[source]
class Graphs[source]

Contains several Graph

updateChildren()[source]
add_trace_firstGraph(data, updateChildren=True)[source]

Same as add_trace, but only if graphs has only one id :param data: :param updateChildren: :return:

add_trace(idGraph, data, updateChildren=True)[source]

Add a trace to the graph

Parameters:
  • idGraph – id of the graph
  • dataData
  • updateChildren – Automatically calls callback functions
Returns:

id of the created trace

remove_trace(idGraph, idTrace, updateChildren=True)[source]

Remove the trace from the graph

Parameters:
  • idGraph – id of the graph
  • idTrace – id of the trace to remove
  • updateChildren – Automatically calls callback functions
get_first_graph()[source]

Get id of the first graph

Returns:id of the first graph
get_graph(idGraph)[source]

Get graph object at idgraph

Parameters:idGraph – id of the graph to get
Returns:Graph
get_all_graphs_ids()[source]

Get all ids of the graphs

Returns:list of id graphs
get_all_graphs()[source]

Get all graphs. Return dict {id: Graph}

add_graph(updateChildren=True)[source]

Add a new graph

Returns:id of the created graph
remove_graph(idGraph)[source]

Delete a graph

Parameters:idGraph – id of the graph to delete
add_update_method(childObject)[source]

Add a callback each time a graph is modified.

Parameters:childObject – method without arguments
export_str()[source]

Export all the graphs in text

Returns:str
merge(otherGraphs)[source]
reset()[source]
is_empty()[source]