``graphs`` ============================== .. py:module:: optimeed.core.graphs Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: optimeed.core.graphs.Data optimeed.core.graphs.Graph optimeed.core.graphs.Graphs .. py: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) 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) .. py:method:: set_kwargs(kwargs) Set a kwarg after creation of the class .. py:method:: set_data(x: list, y: list) Overwrites current datapoints with new set .. py:method:: set_meta(meta) Set associated 'Z' data .. py:method:: get_x() Get x coordinates of datapoints .. py:method:: get_symbolsize() Get size of the symbols .. py:method:: symbol_isfilled() Check if symbols has to be filled or not .. py:method:: get_symbolOutline() Get color factor of outline of symbols .. py:method:: get_length_data() Get number of points .. py:method:: get_xlim() Get x limits of viewbox .. py:method:: get_ylim() Get y limits of viewbox .. py:method:: get_y() Get y coordinates of datapoints .. py:method:: get_meta() Get associated 'Z' data .. py:method:: get_color() Get color of the line, without transformation .. py:method:: get_color_alpha() Get color of the line. Return r, g, b in 0, 255 scale .. py:method:: get_alpha() Get opacity .. py:method:: get_width() Get width of the line .. py:method:: get_number_of_points() Get number of points .. py:method:: get_plot_data() Call this method to get the x and y coordinates of the points that have to be displayed. => After transformation, and after permutations. :return: x (list), y (list) .. py:method:: get_plot_meta(x, y) Call this method to get the z coordinates of the points that been displayed. => After transformation, and after permutations. :return: z (list) .. py:method:: get_permutations(x=None) Return the transformation 'permutation': xplot[i] = xdata[permutation[i]] .. py:method:: get_invert_permutations() Return the inverse of permutations: xdata[i] = xplot[revert[i]] .. py:method:: get_dataIndex_from_graphIndex(index_graph_point) From an index given in graph, recovers the index of the data. :param index_graph_point: Index in the graph :return: index of the data .. py:method:: get_dataIndices_from_graphIndices(index_graph_point_list) Same as get_dataIndex_from_graphIndex but with a list in entry. Can (?) improve performances for huge dataset. :param index_graph_point_list: List of Index in the graph :return: List of index of the data .. py:method:: get_graphIndex_from_dataIndex(index_data) From an index given in the data, recovers the index of the graph. :param index_data: Index in the data :return: index of the graph .. py:method:: get_graphIndices_from_dataIndices(index_data_list) Same as get_graphIndex_from_dataIndex but with a list in entry. Can (?) improve performances for huge dataset. :param index_data_list: List of Index in the data :return: List of index of the graph .. py:method:: set_permutations(permutations) Set permutations between datapoints of the trace :param 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) .. py:method:: get_x_label() Get x label of the trace .. py:method:: get_y_label() Get y label of the trace .. py:method:: get_legend() Get name of the trace .. py:method:: get_symbol() Get symbol .. py:method:: add_point(x, y) Add point(s) to trace (inputs can be list or numeral) .. py:method:: delete_point(index_point) Delete a point from the datapoints .. py:method:: isScattered() Check if plot is scatteded .. py:method:: set_indices_points_to_plot(indices) Set indices points to plot .. py:method:: get_indices_points_to_plot() Get indices points to plot .. py:method:: get_linestyle() Get linestyle .. py:method:: __str__() Return str(self). .. py:method:: export_str() Method to save the points constituting the trace .. py:method:: set_color(theColor) Set trace color .. py:method:: set_legend(theLegend) Set legend .. py:class:: Graph Simple graph container that contains several traces .. py:method:: add_trace(data) Add a trace to the graph :param data: :class:`~Data` :return: id of the created trace .. py:method:: remove_trace(idTrace) Delete a trace from the graph :param idTrace: id of the trace to delete .. py:method:: get_trace(idTrace) -> Data Get data object of idTrace :param idTrace: id of the trace to get :return: :class:`~Data` .. py:method:: get_all_traces() Get all the traces id of the graph .. py:method:: get_all_traces_ids() Get all the traces id of the graph :return: list of id graphs .. py:method:: export_str() .. py:class:: Graphs Contains several :class:`Graph` .. py:method:: updateChildren() .. py:method:: add_trace_firstGraph(data, updateChildren=True) Same as add_trace, but only if graphs has only one id :param data: :param updateChildren: :return: .. py:method:: add_trace(idGraph, data, updateChildren=True) Add a trace to the graph :param idGraph: id of the graph :param data: :class:`~Data` :param updateChildren: Automatically calls callback functions :return: id of the created trace .. py:method:: remove_trace(idGraph, idTrace, updateChildren=True) Remove the trace from the graph :param idGraph: id of the graph :param idTrace: id of the trace to remove :param updateChildren: Automatically calls callback functions .. py:method:: get_first_graph() Get id of the first graph :return: id of the first graph .. py:method:: get_graph(idGraph) Get graph object at idgraph :param idGraph: id of the graph to get :return: :class:`~Graph` .. py:method:: get_all_graphs_ids() Get all ids of the graphs :return: list of id graphs .. py:method:: get_all_graphs() Get all graphs. Return dict {id: :class:`~Graph`} .. py:method:: add_graph(updateChildren=True) Add a new graph :return: id of the created graph .. py:method:: remove_graph(idGraph) Delete a graph :param idGraph: id of the graph to delete .. py:method:: add_update_method(childObject) Add a callback each time a graph is modified. :param childObject: method without arguments .. py:method:: export_str() Export all the graphs in text :return: str .. py:method:: merge(otherGraphs) .. py:method:: reset() .. py:method:: is_empty()