graphs

Module Contents

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, symbol='o', symbolsize=8, fillsymbol=True, outlinesymbol=1.8, linestyle='-', width=2)[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_data(self, x: list, y: list)[source]

Overwrites current datapoints with new set

get_x(self)[source]

Get x coordinates of datapoints

get_symbolsize(self)[source]

Get size of the symbols

symbol_isfilled(self)[source]

Check if symbols has to be filled or not

get_symbolOutline(self)[source]

Get color factor of outline of symbols

get_length_data(self)[source]

Get number of points

get_xlim(self)[source]

Get x limits of viewbox

get_ylim(self)[source]

Get y limits of viewbox

get_y(self)[source]

Get y coordinates of datapoints

get_color(self)[source]

Get color of the line

get_width(self)[source]

Get width of the line

get_number_of_points(self)[source]

Get number of points

get_plot_data(self)[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_permutations(self, x=None)[source]

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

get_invert_permutations(self)[source]

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

get_dataIndex_from_graphIndex(self, 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(self, 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(self, 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(self, 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(self, 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(self)[source]

Get x label of the trace

get_y_label(self)[source]

Get y label of the trace

get_legend(self)[source]

Get name of the trace

get_symbol(self)[source]

Get symbol

add_point(self, x, y)[source]

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

delete_point(self, index_point)[source]

Delete a point from the datapoints

is_scattered(self)[source]

Delete a point from the datapoints

set_indices_points_to_plot(self, indices)[source]

Set indices points to plot

get_indices_points_to_plot(self)[source]

Get indices points to plot

get_linestyle(self)[source]

Get linestyle

__str__(self)[source]
export_str(self)[source]

Method to save the points constituting the trace

set_color(self, theColor)[source]
class Graph[source]

Simple graph container that contains several traces

add_trace(self, data)[source]

Add a trace to the graph

Parameters

dataData

Returns

id of the created trace

remove_trace(self, idTrace)[source]

Delete a trace from the graph

Parameters

idTrace – id of the trace to delete

get_trace(self, idTrace)[source]

Get data object of idTrace

Parameters

idTrace – id of the trace to get

Returns

Data

get_all_traces(self)[source]

Get all the traces id of the graph

export_str(self)[source]
class Graphs[source]

Contains several Graph

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

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

add_trace(self, 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(self, 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(self)[source]

Get id of the first graph

Returns

id of the first graph

get_graph(self, idGraph)[source]

Get graph object at idgraph

Parameters

idGraph – id of the graph to get

Returns

Graph

get_all_graphs_ids(self)[source]

Get all ids of the graphs

Returns

list of id graphs

get_all_graphs(self)[source]

Get all graphs. Return dict {id: Graph}

add_graph(self, updateChildren=True)[source]

Add a new graph

Returns

id of the created graph

remove_graph(self, idGraph)[source]

Delete a graph

Parameters

idGraph – id of the graph to delete

add_update_method(self, childObject)[source]

Add a callback each time a graph is modified.

Parameters

childObject – method without arguments

export_str(self)[source]

Export all the graphs in text

Returns

str

merge(self, otherGraphs)[source]
reset(self)[source]
is_empty(self)[source]