LMS Color Space is based on responsivity of 3 cones in Human eyes with each having different curves. I'm looking for a way to plot those curves. Moreover, Is threre a way to covert wavelength under visible spectrum to RGB or XYZ colorspace?
You can certainly convert the wavelengths of the visible spectrum into the XYZ colour space with some extra considerations. Converting wavelengths of the visible spectrum into RGB will present some problems due to the gamut limits of RGB. The wavelengths of the visible spectrum are usually displayed in the CIE 1931 xy chromaticity space, where each wavelength has a fixed xy position independent of intensity. In LMS, XYZ, RGB and most colour spaces, the position will depend on the intensity of the wavelength. (Please note that the lowercase xy chromaticity values are not the same as the uppercase XY of the XYZ values.) This means you need to choose the intensity for each wavelength, and will get different results based on what you choose. The graph below shows the shape to expect for equal intensity of each wavelength, intensity of the wavelength in typical sunlight, and the maximum intensity which stimulates one of the cones in the human eye at 100%. For comparison there is a hexagon which shows the limit of the sRGB gamut. There is one dot for each 5-nanometre difference in wavelength. This chart is showing the values in the colour plane of DKL space, where the values are calculated from the three cone L, M and S values. The horizontal axis is the (L-M)*4.5, and the vertical axis is (L+M)/2 – S. The graph showing wavelengths as maximum intensity is the outside limit of what values are possible, with the conceptual “line of purples” joining the two extreme ends of the graph. Converting these values into RGB requires mapping values outside of the RGB gamut into the RGB gamut. Here is some analysis of an RGB image of a spectrum (presumably of daylight) showing how the image mapped the values showing the same 2d range as in the chart above. You can see how the shape below relates to the Sunlight graph above. The hexagon in white is again the RGB limit, and the curved shape outside of it is the MacAdam limit, which is a theoretical limit of surface colours. (The colours below are just illustrating this two-dimensional position in RGB space, they are not the colours of the actual pixels.) I was initially expecting that a photograph of a spectrum would necessarily be the outside limit of colours in RGB space. When I investigated further, I learned that wavelengths of light are only at the outside edge of possible colours when viewed at maximum intensity, such as viewing one wavelength on its own in a dark environment. If you look at the LMS response curves below, you can see that between blue and green, around 490 nanometres, none of the cones respond strongly, so the colour sensation at that wavelength is notably weak when viewed in a whole spectrum. At the far-red end beyond 640 nanometres the L cones responds many times more strongly than the M cone, so the colour response of those pure wavelengths is much stronger than any mix of wavelengths that is likely to be seen reflecting from an object.
The graphs of the spectrum in DKL space above do show an explanation for why the spectrum appears to have bands of colour. Where the dots are closely spaced there is little difference in perceived colour across a range of wavelengths. Where the dots are widely spaced there is a greater difference in perceived colour. This creates the appearance of bands of colour separated from each other. The reason for this can be seen in the LMS response curve chart above. From 430 to 460 nanometres none of the response curves change greatly. This is in contrast to the range from 470 to 500 nanometres, where the S response drops off sharply as the L and M responses increase more sharply. This creates the impression of a blue colour band which then changes to another band as the wavelength increases.
As Nathan Reed said in the comment, the necessary tables are on cvrl.org, and there is more useful information about conversion between different colour spaces on www.brucelindbloom.com