Plot not showing in Ubuntu terminal

I am using [import matplotlib.pyplot as plt] in a code in ubuntu terminal and thats showing segmentation error but when i used [matplotlib.use(‘TkAgg’)] graph is showing so what to do about that?

It is difficult to provide any concrete advice because you have not provided enough information.

However, my guess is that you have a broken installation (likely a cross of pip and system packages or pip and conda packages) where Python is seeing multiple crossed versions of Qt and and that is what is segfaulting. If you do not specify a GUI framework to use we look for the first one you have installed based on a hard-coded order which has Qt at the front.

When you set the backend to tkagg you are avoiding our discovery process and saying “use Tk” which as it comes bundled with Python is much harder to have broken installations of.