Are plants actual oxygen factories?
All green plants do Photosynthesis as well as Respiration.

Plants respire during the day and night, but they only photosynthesis during the day when it is light: 
there is equations for aerobic respiration and photosynthesis:

C6H12O6 + 6O2 → 6CO2 + 6H2O (aerobic respiration)

6CO2 + 6H2O → C6H12O6 + 6O2 (photosynthesis)

In terms of reactants and products, they are the reverse of each other. In terms of gas exchange:

Process        -------Carbon dioxide    -----------------Oxygen

Respiration     -----------Out  ----------------------------    In

Photosynthesis  -------In         ----------------------------    Out



Photosynthesis is only in the presence of Sunlight . So it occurs only during the day .

For photosynthesis they require Carbon Dioxide gas ( CO2 gas )

This gas enters the leaves through tiny pores on them called stomata .

The byproduct of photosynthesis is Oxygen gas ( O2 gas )

It is either passes out through the same stomata OR used for respiration



For respiration they require O2 gas .
It enters the leaves through the same pores or stomata .

The by product of respiration is CO2 gas .

During day time it is immediately used for photosynthesis .

During night time the CO2 gas is released in the atmosphere



Net gas exchange

The net (overall) effect depends on the time of day and the light intensity. Photosynthesis doesn’t occur at night. When there is no photosynthesis, there is a net release of carbon dioxide and a net uptake of oxygen.

If there is enough light during the day, then:

the rate of photosynthesis is higher than the rate of respiration
there is a net release of oxygen and a net uptake of carbon dioxide


(consider CAM plants)

in a plant using full CAM, the stomata in the leaves remain shut during the day to reduce evapotranspiration, but open at night to collect carbon dioxide (CO2)

https://en.wikipedia.org/wiki/Crassulacean_acid_metabolism#During_the_night



this link help you understand the process better by simple language :

http://www.bbc.co.uk/education/guides/zxtcwmn/revision/1