La Pérouse brought fruit trees and an herb garden on his fatal voyage; his gardener also tended the root cellar. Through the ages, how common or uncommon has it been to cultivate plants aboard a ship?
Since the question specifies the Age-of-Sail, we're concerned with the period between 1650 and 1850. The link between nutrition and health on long voyages was only really established in the last half century of that period. So the idea of cultivating fresh vegetables and fruit for the voyage would not have been an obvious one for most of the Age-of-Sail.
Sailing ships of the period were typically capable of carrying stores for up to 3-6 months (depending on the size of the ship and crew). In the normal course of a journey, these stores would be replenished any time that the ship was in reach of a friendly coast. Since the vast majority of voyages in this period were relatively short (and most of those were along coastal routes), ships could be kept provisioned without the need to grow their own food.
So only very long distance voyages, such as these voyages of discovery where the possibility of being unable to replenish from shore was in doubt, would raise the need for on-board cultivation of foods. (N.B: live animals were kept on board ships to provide fresh meat but these were in small numbers to meet short-term needs rather than providing long-term sustainence.)
The Wikipedia articles on Lapérouse's ships, the Astrolabe and the Boussole, notes that they were specially fitted for this scientific voyage. I would imagine that the addition of a garden could have been part of this fitting out process (although it's not explicitly mentioned). There's also the possibility that the garden(s) may have been intended to help bring back live plant samples from their voyage.
There are several difficulties with maintaining a garden on board a sailing ship of the period;
- There's a limit on deck space. By modern standards, sailing ships were small and cramped. The weather (topmost) deck, which would have been the most obvious location for a garden, would already be filled with much of the equipment needed to sail and control the vessel (along with the ship's boats).
- The ships weren't weather proof. In heavy weather it wouldn't be unusual for spray (or even waves) to sweep over the entire ship. So there would be a real risk of the garden being washed into the sea.
- Plants and seawater generally don't mix well. There are some plant varieties that can grow in coastal areas that tolerate higher salt concentrations but these are not your typical human foodstuff.
- Most plants are adapted to their own environments. Too much or too little sunlight or fresh water can damage or even kill them. Freezing temperatures can kill them. So this would restrict the latitudes which would be suitable for the garden to prosper.
- Even if the garden is kept alive and healthy, the harvest of fruits and vegetables is only going to happen once per growing season (so it's not going to provide a steady source of nutrition). For plants away from their natural habitats, there may also be a problem with pollination if its dependent on specific insects.
So all in all, it's safe to assume that gardens were not typical fittings on ships of the period.
If gardens were common on ships of the age of sail, then we would expect them to appear on ship's plans and on ship's models (which were manufactured as a type of blueprint prior to the ship's construction). I've never seen a ship's plan or model that featured one, which either suggests that they weren't common or that only atypical ships' plans and models survived to the modern age. The former seems more likely than the latter.
You would also expect gardens to rate a mention in books and articles of the time. The famous Faulkner's Universal Dictionary of the Marine which covers naval terminology for almost anything carried on a ship makes no mention of them.
Chinese junks allegedly sometimes grew plants aboard that may have provided part of the diet of their crews.
Avoiding the Die straits: An Inquiry into Food Provisioning and Scurvy in the Maritime and Military History of China and wider East Asia Mathieu Torck, Pages 132-134, 146, 150
A description of the super ship Syracusa of the third century BC includes:
And along the uppermost passage was a gymnasium and walks, having their appointment in all respects corresponding to the size of the vessel. And in them were gardens of all sorts of most wonderful beauty, enriched with all sorts of plants, and shaded by roofs of lead or tiles. And besides this there were tents roofed with boughs of white ivy and of the vine, the roots of which derived their moisture from casks full of earth, and were watered in the same manner as the gardens. And the tents themselves helped to shadow the walks.
In 1789 HMS Bounty collected 1,015 live breadfruit plants in Tahiti and potted them for transport to the West Indies as a new food source there. Because of the mutiny, Bligh had to make another voyage to Tahiti on HMS Providence to collect another set of breadfruit plants to introduce in St. Helena, St. Vincent, and Jamaica. Bounty and Providence may have been the European sailing ships that carried the most live food plants.
So sometimes plants were grown aboard sailing ships, but that would have been many times more common in East Asian ships than in European ships. And probably only common on a small subset of East Asian sailing ships.