This is indeed a very open-ended question, and it sadly shows little previous research efforts.
I would say at this level of previous knowledge it suffices to say that ultimately, pixels are just memory locations that can be accessed using ordinary read and write operations in any language that allows memory access. There are different possible ways pixel data is organized in memory, but for simplicity you may assume that each pixel could be represented as a three-byte element of red, green and blue intensities in an array of width*height size.
The graphics libraries (and often the associated hardware) knows how to translate x/y coordinates into array indices, how pixel values are combined when pixels shouldn't be fully overwritten for transparency or anti-aliasing etc. But at the end of the day, it's just array elements being read and written.
In many cases, there are additional copying steps involved. For example, a graph drawing library might write pixels into ordinary main memory, and the window system and graphics driver copy these to screen memory.
Whether the high-level code is matplotlib, a text processor, or some game, doesn't really matter.