I am currently learning R and ggplot2 to generate a figure for a scientific publication. In the learning process I asked a few questions on how to create specific plots. How can I use the figure form the code I derived from the answers I got on Stack Overflow in my publication (which probably will not be released under cc by-sa 3.0)?

Do I need to contact the user that gave me the answer in order to ask for their consent?

Am I subjected to the license if the "solution" (sometimes basic) was used, but not the code itself? (no copy/paste!)

When is code copyrighted and when is it just the "natural use" of the programming language? I don't think copyright applies on something like print('hello world'), but is there a limit that is usually accepted?

I came across this post and wiki where I feel the situation discussed is similar and where the distinction between "using" and "publishing" the code is made. I would also like to stress that I am talking about 4-5 lines of code which probably are under the "snippets" category or about language 'tricks'. I would find useful if Stack Overflow people would give some real life example of how they expect this licencing to be implemented with some fair use/unfair use situation.

IANAL, but I would be very surprised (shocked really) if you have to attribute the SO post for publishing the graph you created from your data using it. I would attribute R (using the output of citation()) and possibly the ggplot2 package (though usually I don't). I might mention an SO post in the acknowledgments if it was particularly helpful. –  Roland Aug 4 at 9:57
Would this be on topic at academia.SE? –  Dan Neely Aug 4 at 17:48
I think you should read the terms of service of StackOverflow. That should answer your question better than the guesses below, or at least be a sounder starting point. stackexchange.com/legal –  matt Aug 4 at 18:12
All scientific work as described is protected as Fair Use and you should not waste even once second worrying about the copyright trolls. Entirely apart from that, it's your own work. –  criticalfix Aug 5 at 14:16
Um, fair use doesn't even exist in many countries, and it's hardly automatically protected against all uses (obvious example, you can't take someone else's work and republish it in its entirety as your own). –  Joe Aug 5 at 16:14
Aren't all StackExchange sites all licensed CC-BY? –  anaximander Aug 6 at 14:04
@criticalfix I believe "Fair Use" is a US legal term. The term and the rights it encapsulates doesn't necessarily apply in all the places people who ask and answer questions here are from. If the original poster is in Senegal and the answerer is in Australia (say), what you assert to be protected by fair use may not necessarily be of help. What good is a US legal doctrine if they're not in the US? The SO terms of service and licensing may have some standing as a contract, but US legal protections like fair use may have little bearing on them. –  Glen_b Aug 6 at 22:42

1 Answer 1

I'm not a lawyer but my guess is that the license of the content at SO is irrelevant here since you do not publish the content of SO itself but only a work created by the content. The work itself (the figure) is in my opinion not subject to the license - it's fully yours. I think that everything you can achieve with the content published here is not affected by the content license, only the content itself.

However for many scientific publications they want that you specify all relevant contributions. This has nothing to do with the license used here but with good scientific conduct.

However a bit of code for displaying a figure nicely probably wouldn't qualify as relevant contribution.

If you insist on something:

The author acknowledges the help of the StackOverflow community in the display of the data.

should be fine.

+1 If software/code licenses were relevant for what you produce with the software, I'd be more concerned about using Excel than some code with a free license. –  Roland Aug 4 at 11:36
@Roland What about licenses for software that say it's not for commercial use? –  Jakub Kania Aug 5 at 23:18
@JakubKania Please ask a lawyer if you have a specific case in mind. The question is about scientific use, which usually isn't commercial. –  Roland Aug 6 at 7:01
@Roland yes, however I am just pointing out that it seems there are cases where license matters for what you produce with software. –  Jakub Kania Aug 6 at 10:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .